Previous 199869 Revisions Next

r31657 Thursday 14th August, 2014 at 22:01:03 UTC by hap
nothing much
[src/emu/cpu/i86]i186.c i186.h
[src/emu/machine]pit8253.c
[src/mame/audio]leland.c
[src/mame/includes]leland.h
[src/mame/video]leland.c

trunk/src/emu/cpu/i86/i186.c
r31656r31657
153153
154154UINT8 i80186_cpu_device::fetch_op()
155155{
156   UINT8 data;
157   data = m_direct->read_decrypted_byte(pc(), m_fetch_xor);
156   UINT8 data = m_direct->read_decrypted_byte(pc(), m_fetch_xor);
158157   m_ip++;
159158   return data;
160159}
161160
162161UINT8 i80186_cpu_device::fetch()
163162{
164   UINT8 data;
165   data = m_direct->read_raw_byte(pc(), m_fetch_xor);
163   UINT8 data = m_direct->read_raw_byte(pc(), m_fetch_xor);
166164   m_ip++;
167165   return data;
168166}
r31656r31657
181179         m_prev_ip = m_ip;
182180         m_seg_prefix = false;
183181
184            /* Dispatch IRQ */
182         /* Dispatch IRQ */
185183         if ( m_pending_irq && m_no_interrupt == 0 )
186184         {
187185            if ( m_pending_irq & NMI_IRQ )
r31656r31657
252250            m_regs.w[DI] = POP();
253251            m_regs.w[SI] = POP();
254252            m_regs.w[BP] = POP();
255                        POP();
253            POP();
256254            m_regs.w[BX] = POP();
257255            m_regs.w[DX] = POP();
258256            m_regs.w[CX] = POP();
r31656r31657
344342               logerror("%s: %06x: Mov Sreg - Invalid register\n", tag(), pc());
345343               m_ip = m_prev_ip;
346344               interrupt(6);
345               break;
347346            }
348347            break;
349348
r31656r31657
522521                  // Decrement IP and pass on
523522                  m_ip -= 1 + (m_seg_prefix_next ? 1 : 0);
524523                  pass = true;
524                  break;
525525               }
526526               if(!pass)
527527               {
r31656r31657
530530                  break;
531531               }
532532            }
533
533            // through to default
534534         default:
535535            if(!common_op(op))
536536            {
r31656r31657
555555
556556   state_add(STATE_GENPC, "curpc", m_pc).callimport().callexport().formatstr("%05X");
557557
558   // register for savestates
558559   save_item(NAME(m_timer[0].control));
559560   save_item(NAME(m_timer[0].maxA));
560561   save_item(NAME(m_timer[0].maxB));
r31656r31657
593594   save_item(NAME(m_mem.middle_size));
594595   save_item(NAME(m_mem.peripheral));
595596   save_item(NAME(m_reloc));
596
597   
598   // zerofill
599   memset(m_timer, 0, sizeof(m_timer));
600   memset(m_dma, 0, sizeof(m_dma));
601   memset(&m_intr, 0, sizeof(intr_state));
602   memset(&m_mem, 0, sizeof(mem_state));
603   m_reloc = 0;
604   
597605   m_timer[0].int_timer = timer_alloc(TIMER_INT0);
598606   m_timer[1].int_timer = timer_alloc(TIMER_INT1);
599607   m_timer[2].int_timer = timer_alloc(TIMER_INT2);
r31656r31657
618626   m_intr.ext[3]           = 0x000f;
619627   m_intr.in_service       = 0x0000;
620628
621   m_intr.pending           = 0x0000;
622   m_intr.ack_mask          = 0x0000;
623   m_intr.request           = 0x0000;
624   m_intr.status            = 0x0000;
625   m_intr.poll_status       = 0x0000;
626   m_intr.ext_state         = 0x00;
629   m_intr.pending          = 0x0000;
630   m_intr.ack_mask         = 0x0000;
631   m_intr.request          = 0x0000;
632   m_intr.status           = 0x0000;
633   m_intr.poll_status      = 0x0000;
634   m_intr.ext_state        = 0x00;
627635   m_reloc = 0x20ff;
628636   
629   for(int i = 0; i < ARRAY_LENGTH(m_dma); ++i)
637   for (int i = 0; i < ARRAY_LENGTH(m_dma); i++)
630638   {
631639      m_dma[i].drq_state = false;
632640      m_dma[i].control = 0;
633641   }
634642
635   for(int i = 0; i < ARRAY_LENGTH(m_timer); ++i)
643   for (int i = 0; i < ARRAY_LENGTH(m_timer); i++)
636644   {
637645      m_timer[i].control = 0;
638646      m_timer[i].maxA = 0;
r31656r31657
708716   set_input_line(0, CLEAR_LINE);
709717   m_intr.pending = 0;
710718
711   oldreq=m_intr.request;
719   oldreq = m_intr.request;
712720
713721   /* clear the request and set the in-service bit */
714722   if(m_intr.ack_mask & 0xf0)
r31656r31657
726734   if((LOG_INTERRUPTS) && (m_intr.request!=oldreq))
727735      logerror("intr.request changed from %02X to %02X\n",oldreq,m_intr.request);
728736
729   old=m_intr.in_service;
737   old = m_intr.in_service;
730738
731739   m_intr.in_service |= m_intr.ack_mask;
732740
r31656r31657
750758   /* return the vector */
751759   switch(m_intr.poll_status & 0x1F)
752760   {
753      case 0x0C   : vector=(m_intr.ext[0] & EXTINT_CTRL_CASCADE) ? m_read_slave_ack_func(0) : (m_intr.poll_status & 0x1f); break;
754      case 0x0D   : vector=(m_intr.ext[1] & EXTINT_CTRL_CASCADE) ? m_read_slave_ack_func(1) : (m_intr.poll_status & 0x1f); break;
755      default :
756         vector=m_intr.poll_status & 0x1f; break;
761      case 0x0C: vector = (m_intr.ext[0] & EXTINT_CTRL_CASCADE) ? m_read_slave_ack_func(0) : (m_intr.poll_status & 0x1f); break;
762      case 0x0D: vector = (m_intr.ext[1] & EXTINT_CTRL_CASCADE) ? m_read_slave_ack_func(1) : (m_intr.poll_status & 0x1f); break;
763      default:
764         vector = m_intr.poll_status & 0x1f; break;
757765   }
758766
759767   if (LOG_INTERRUPTS)
r31656r31657
932940/* Trigger an external interrupt, optionally supplying the vector to take */
933941void i80186_cpu_device::external_int(UINT16 intno, int state)
934942{
935   if(!(m_intr.ext_state & (1 << intno)) == !state)
943   if (!(m_intr.ext_state & (1 << intno)) == !state)
936944      return;
937945
938946   if (LOG_INTERRUPTS_EXT) logerror("generating external int %02X\n",intno);
939947
940   if(!state)
948   if (!state)
941949   {
942      m_intr.request &= ~(0x010 << intno);
943      m_intr.ack_mask &= ~(0x0010 << intno);
950      m_intr.request &= ~(0x10 << intno);
951      m_intr.ack_mask &= ~(0x10 << intno);
944952      m_intr.ext_state &= ~(1 << intno);
945953   }
946954   else // Turn on the requested request bit and handle interrupt
947955   {
948      m_intr.request |= (0x010 << intno);
956      m_intr.request |= (0x10 << intno);
949957      m_intr.ext_state |= (1 << intno);
950958   }
951959   update_interrupt_state();
r31656r31657
966974      case TIMER_INT2:
967975      {
968976         int which = param;
969         struct timer_state *t = &m_timer[which];
977         timer_state *t = &m_timer[which];
970978
971979         if (LOG_TIMER) logerror("Hit interrupt callback for timer %d\n", which);
972980
r31656r31657
10411049
10421050void i80186_cpu_device::internal_timer_sync(int which)
10431051{
1044   struct timer_state *t = &m_timer[which];
1052   timer_state *t = &m_timer[which];
10451053
10461054   /* if we have a timing timer running, adjust the count */
10471055   if ((t->control & 0x8000) && !(t->control & 0x0c))
r31656r31657
10501058
10511059void i80186_cpu_device::inc_timer(int which)
10521060{
1053   struct timer_state *t = &m_timer[which];
1061   timer_state *t = &m_timer[which];
10541062
10551063   t->count++;
10561064   if (t->control & 2)
r31656r31657
10621070      device_timer(*t->int_timer, which, which, NULL);
10631071}
10641072
1065void i80186_cpu_device::internal_timer_update(int which,int new_count,int new_maxA,int new_maxB,int new_control)
1073void i80186_cpu_device::internal_timer_update(int which, int new_count, int new_maxA, int new_maxB, int new_control)
10661074{
1067   struct timer_state *t = &m_timer[which];
1075   timer_state *t = &m_timer[which];
10681076   int update_int_timer = 0;
10691077
10701078   if (LOG_TIMER)
1071      logerror("internal_timer_update: %d, new_count=%d, new_maxA=%d, new_maxB=%d,new_control=%d\n",which,new_count,new_maxA,new_maxB,new_control);
1079      logerror("internal_timer_update: %d, new_count=%d, new_maxA=%d, new_maxB=%d,new_control=%d\n", which, new_count, new_maxA, new_maxB, new_control);
10721080
10731081   /* if we have a new count and we're on, update things */
10741082   if (new_count != -1)
r31656r31657
11921200
11931201void i80186_cpu_device::update_dma_control(int which, int new_control)
11941202{
1195   struct dma_state *d = &m_dma[which];
1203   dma_state *d = &m_dma[which];
11961204   int diff;
11971205
11981206   /* handle the CHG bit */
r31656r31657
12131221
12141222void i80186_cpu_device::drq_callback(int which)
12151223{
1216   struct dma_state *dma = &m_dma[which];
1224   dma_state *dma = &m_dma[which];
12171225
12181226   UINT16  dma_word;
12191227   UINT8   dma_byte;
r31656r31657
12221230   if (LOG_DMA>1)
12231231      logerror("Control=%04X, src=%05X, dest=%05X, count=%04X\n",dma->control,dma->source,dma->dest,dma->count);
12241232
1225   if(!(dma->control & ST_STOP))
1233   if (!(dma->control & ST_STOP))
12261234   {
12271235      if(LOG_DMA)
12281236         logerror("%05X:ERROR! - drq%d with dma channel stopped\n", pc(), which);
r31656r31657
12331241   address_space *src_space = (dma->control & SRC_MIO) ? m_program : m_io;
12341242
12351243   // Do the transfer, 80188 is incapable of word transfers
1236   if((dma->control & BYTE_WORD) && (m_program->data_width() == 16))
1244   if ((dma->control & BYTE_WORD) && (m_program->data_width() == 16))
12371245   {
1238      dma_word=src_space->read_word(dma->source);
1239      dest_space->write_word(dma->dest,dma_word);
1240      incdec_size=2;
1246      dma_word = src_space->read_word(dma->source);
1247      dest_space->write_word(dma->dest, dma_word);
1248      incdec_size = 2;
12411249   }
12421250   else
12431251   {
1244      dma_byte=src_space->read_byte(dma->source);
1245      dest_space->write_byte(dma->dest,dma_byte);
1246      incdec_size=1;
1252      dma_byte = src_space->read_byte(dma->source);
1253      dest_space->write_byte(dma->dest, dma_byte);
1254      incdec_size = 1;
12471255   }
12481256
12491257   // Increment or Decrement destination and source pointers as needed
r31656r31657
12711279   dma->count -= 1;
12721280
12731281   // Terminate if count is zero, and terminate flag set
1274   if(((dma->control & TERMINATE_ON_ZERO) || !(dma->control & SYNC_MASK)) && (dma->count==0))
1282   if (((dma->control & TERMINATE_ON_ZERO) || !(dma->control & SYNC_MASK)) && (dma->count == 0))
12751283   {
12761284      dma->control &= ~ST_STOP;
12771285      if (LOG_DMA) logerror("DMA terminated\n");
12781286   }
12791287
12801288   // Interrupt if count is zero, and interrupt flag set
1281   if((dma->control & INTERRUPT_ON_ZERO) && (dma->count==0))
1289   if ((dma->control & INTERRUPT_ON_ZERO) && (dma->count == 0))
12821290   {
12831291      if (LOG_DMA>1) logerror("DMA%d - requesting interrupt: count = %04X, source = %04X\n", which, dma->count, dma->source);
12841292      m_intr.request |= 0x04 << which;
r31656r31657
14561464         logerror("%05X:read 80186 port %02X\n", pc(), offset);
14571465         break;
14581466   }
1459   return 0x00;
1467
1468   return 0x0000;
14601469}
14611470
14621471/*************************************
r31656r31657
16681677
16691678      case 0x7f:
16701679         if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", pc(), data);
1671         if((data & 0x1fff) != (m_reloc & 0x1fff))
1680         if ((data & 0x1fff) != (m_reloc & 0x1fff))
16721681         {
16731682            UINT32 newmap = (data & 0xfff) << 8;
16741683            UINT32 oldmap = (m_reloc & 0xfff) << 8;
trunk/src/emu/cpu/i86/i186.h
r31656r31657
5757   void handle_eoi(int data);
5858   void external_int(UINT16 intno, int state);
5959   void internal_timer_sync(int which);
60   void internal_timer_update(int which,int new_count,int new_maxA,int new_maxB,int new_control);
60   void internal_timer_update(int which, int new_count, int new_maxA, int new_maxB, int new_control);
6161   void update_dma_control(int which, int new_control);
6262   void drq_callback(int which);
6363   void inc_timer(int which);
r31656r31657
9090      UINT32      dest;
9191      UINT16      count;
9292      UINT16      control;
93      emu_timer   *finish_timer;
9493   };
9594
9695   struct intr_state
9796   {
98      UINT8   pending;
99      UINT16  ack_mask;
100      UINT16  priority_mask;
101      UINT16  in_service;
102      UINT16  request;
103      UINT16  status;
104      UINT16  poll_status;
105      UINT16  timer;
106      UINT16  dma[2];
107      UINT16  ext[4];
108      UINT8   ext_state;
97      UINT8       pending;
98      UINT16      ack_mask;
99      UINT16      priority_mask;
100      UINT16      in_service;
101      UINT16      request;
102      UINT16      status;
103      UINT16      poll_status;
104      UINT16      timer;
105      UINT16      dma[2];
106      UINT16      ext[4];
107      UINT8       ext_state;
109108   };
110109
110   timer_state     m_timer[3];
111   dma_state       m_dma[2];
112   intr_state      m_intr;
113   mem_state       m_mem;
114
111115   static const device_timer_id TIMER_INT0 = 0;
112116   static const device_timer_id TIMER_INT1 = 1;
113117   static const device_timer_id TIMER_INT2 = 2;
114118
115   struct timer_state  m_timer[3];
116   struct dma_state    m_dma[2];
117   struct intr_state   m_intr;
118   struct mem_state    m_mem;
119119   UINT16 m_reloc;
120120
121121   address_space_config m_program_config;
trunk/src/emu/machine/pit8253.c
r31656r31657
100100   m_out1_handler.resolve_safe();
101101   m_out2_handler.resolve_safe();
102102
103   /* register for state saving */
104103   for (int timerno = 0; timerno < PIT8253_MAX_TIMER; timerno++)
105104   {
106105      pit8253_timer *timer = get_timer(timerno);
trunk/src/mame/audio/leland.c
r31656r31657
245245
246246void leland_80186_sound_device::device_start()
247247{
248   // register for savestates
249   save_item(NAME(m_peripheral));
250   save_item(NAME(m_last_control));
251   save_item(NAME(m_clock_active));
252   save_item(NAME(m_clock_tick));
253   save_item(NAME(m_sound_command));
254   save_item(NAME(m_sound_response));
255   save_item(NAME(m_ext_start));
256   save_item(NAME(m_ext_stop));
257   save_item(NAME(m_ext_active));
258   save_item(NAME(m_dac_sample));
259   save_item(NAME(m_dac_volume));
260   
261   // zerofill
262   m_peripheral = 0;
263   m_last_control = 0;
264   m_clock_active = 0;
265   m_clock_tick = 0;
266   m_sound_command = 0;
267   m_sound_response = 0;
268   m_ext_start = 0;
269   m_ext_stop = 0;
270   m_ext_active = 0;
271   m_ext_base = NULL;
272   memset(m_dac_sample, 0, sizeof(m_dac_sample));
273   memset(m_dac_volume, 0x80, sizeof(m_dac_volume));
274
248275   m_audiocpu = downcast<i80186_cpu_device *>(machine().device("audiocpu"));
249276
250277   /* determine which sound hardware is installed */
r31656r31657
273300   m_ext_active = 0;
274301   memset(m_dac_sample, 0, sizeof(m_dac_sample));
275302   memset(m_dac_volume, 0x80, sizeof(m_dac_volume));
303
276304   m_dac_timer->adjust(attotime::from_hz(48000), 0, attotime::from_hz(48000));
277305}
278306
r31656r31657
361389{
362390   /* see if anything changed */
363391   int diff = (m_last_control ^ data) & 0xf8;
364   if (!diff)
392   if (diff == 0)
365393      return;
366394   m_last_control = data;
367395
r31656r31657
377405   }
378406
379407   /* /RESET */
380   m_audiocpu->device_t::execute().set_input_line(INPUT_LINE_RESET, data & 0x80  ? CLEAR_LINE : ASSERT_LINE);
381   m_audiocpu->device_t::execute().set_input_line(INPUT_LINE_TEST, data & 0x10  ? CLEAR_LINE : ASSERT_LINE);
408   m_audiocpu->device_t::execute().set_input_line(INPUT_LINE_RESET, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
409   m_audiocpu->device_t::execute().set_input_line(INPUT_LINE_TEST, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
382410
383411   /* /NMI */
384412/*  If the master CPU doesn't get a response by the time it's ready to send
385413    the next command, it uses an NMI to force the issue; unfortunately, this
386414    seems to really screw up the sound system. It turns out it's better to
387415    just wait for the original interrupt to occur naturally */
388/*  space.machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, data & 0x40 ? CLEAR_LINE : ASSERT_LINE);*/
416/*  space.machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE);*/
389417
390418   /* INT0 */
391419   m_audiocpu->int0_w(data & 0x20);
trunk/src/mame/includes/leland.h
r31656r31657
259259private:
260260   void command_lo_sync(void *ptr, int param);
261261   void delayed_response_r(void *ptr, int param);
262   void set_clock_line(int which, bool state) { m_clock_active = state ? (m_clock_active | (1<<which)) : (m_clock_active & ~(1<<which)); }
262   void set_clock_line(int which, int state) { m_clock_active = state ? (m_clock_active | (1<<which)) : (m_clock_active & ~(1<<which)); }
263
263264   // internal state
264265   i80186_cpu_device *m_audiocpu;
265266   UINT16 m_peripheral;
trunk/src/mame/video/leland.c
r31656r31657
6363   /* scanline timer */
6464   m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(leland_state::scanline_callback),this));
6565   m_scanline_timer->adjust(m_screen->time_until_pos(0));
66
6766}
6867
6968VIDEO_START_MEMBER(leland_state,ataxx)
r31656r31657
385384
386385UINT32 leland_state::screen_update_leland(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
387386{
388   int y;
389
390387   const UINT8 *bg_prom = memregion("user1")->base();
391388   const UINT8 *bg_gfx = memregion("gfx1")->base();
392389   offs_t bg_gfx_bank_page_size = memregion("gfx1")->bytes() / 3;
r31656r31657
394391   offs_t prom_bank = ((m_gfxbank >> 3) & 0x01) * 0x2000;
395392
396393   /* for each scanline in the visible region */
397   for (y = cliprect.min_y; y <= cliprect.max_y; y++)
394   for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
398395   {
399      int x;
400396      UINT8 fg_data = 0;
401397
402398      UINT16 *dst = &bitmap.pix16(y);
403399      UINT8 *fg_src = &m_video_ram[y << 8];
404400
405401      /* for each pixel on the scanline */
406      for (x = 0; x < VIDEO_WIDTH; x++)
402      for (int x = 0; x < VIDEO_WIDTH; x++)
407403      {
408404         /* compute the effective scrolled pixel coordinates */
409405         UINT16 sx = (x + m_xscroll) & 0x07ff;
r31656r31657
437433
438434         *dst++ = pen;
439435      }
440
441436   }
442437
443438   return 0;
r31656r31657
453448
454449UINT32 leland_state::screen_update_ataxx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
455450{
456   int y;
457
458451   const UINT8 *bg_gfx = memregion("gfx1")->base();
459452   offs_t bg_gfx_bank_page_size = memregion("gfx1")->bytes() / 6;
460453   offs_t bg_gfx_offs_mask = bg_gfx_bank_page_size - 1;
461454
462455   /* for each scanline in the visible region */
463   for (y = cliprect.min_y; y <= cliprect.max_y; y++)
456   for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
464457   {
465      int x;
466458      UINT8 fg_data = 0;
467459
468460      UINT16 *dst = &bitmap.pix16(y);
469461      UINT8 *fg_src = &m_video_ram[y << 8];
470462
471463      /* for each pixel on the scanline */
472      for (x = 0; x < VIDEO_WIDTH; x++)
464      for (int x = 0; x < VIDEO_WIDTH; x++)
473465      {
474466         /* compute the effective scrolled pixel coordinates */
475467         UINT16 sx = (x + m_xscroll) & 0x07ff;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team