Previous 15994 Revisions Next

r10199 Thursday 27th January, 2011 at 00:18:04 UTC by Angelo Salese
[PC-8801]: Fixed YM2203 irq firing, fixes music tempo in several games
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r10198r10199
1515   - Add limits for extend work RAM;
1616   - What happens to the palette contents when the analog/digital palette mode changes?
1717   - dipswitches needs to be controlled;
18   - Several games (most notably Ys series of games) have issues with the YM2203 music tempo (too fast) ... why?
1918
2019   per-game specific TODO:
2120   - 100 Yen disk(s): reads kanji ports;
r10198r10199
162161static UINT8 txt_width, txt_color;
163162static int vblank_pos;
164163#ifdef USE_PROPER_I8214
165static UINT8 m_int_mask,m_int_state;
164static UINT8 timer_irq_mask,vblank_irq_mask,sound_irq_mask,m_int_state;
166165#else
167166static UINT8 i8214_irq_level;
168167static UINT8 vrtc_irq_mask,vrtc_irq_latch;
r10198r10199
910909
911910static WRITE8_HANDLER( i8214_irq_level_w )
912911{
913   i8214_b_w(space->machine->device("i8214"), 0, (data & 0x0f));
912   if(data & 8)
913      i8214_b_w(space->machine->device("i8214"), 0, (7));
914   else
915      i8214_b_w(space->machine->device("i8214"), 0, (data & 0x07));
914916}
915917
916918static WRITE8_HANDLER( i8214_irq_mask_w )
917919{
918   m_int_mask = BITSWAP8((data & 0x07) | (m_int_mask & 0xf8),7,6,5,4,3,0,1,2);
920   timer_irq_mask = data & 1;
921   vblank_irq_mask = data & 2;
919922}
920923
921924
r10198r10199
971974   misc_ctrl = data;
972975
973976   #ifdef USE_PROPER_I8214
974   m_int_mask = (m_int_mask & 0xef) | ((data & 0x80) ? 0x00 : 0x10);
977   sound_irq_mask = ((data & 0x80) == 0);
975978   #else
976979   sound_irq_mask = ((data & 0x80) == 0);
977980
r10198r10199
16901693};
16911694
16921695#ifdef USE_PROPER_I8214
1693void pc8801_raise_irq(running_machine *machine,UINT8 mask)
1696void pc8801_raise_irq(running_machine *machine,UINT8 irq,UINT8 mask)
16941697{
16951698   m_int_state |= mask;
16961699
1697   i8214_r_w(machine->device("i8214"), 0, ~(m_int_state & m_int_mask));
1700   i8214_r_w(machine->device("i8214"), 0, ~irq);
1701
1702   if(mask)
1703      cputag_set_input_line(machine,"maincpu",0,ASSERT_LINE);
16981704}
16991705
17001706static WRITE_LINE_DEVICE_HANDLER( pic_int_w )
17011707{
1702   if (state == ASSERT_LINE)
1703   {
1704      cpu_set_input_line(device, INPUT_LINE_IRQ0, ASSERT_LINE);
1705   }
1708//   if (state == ASSERT_LINE)
1709//   {
1710//   }
17061711}
17071712
1713static WRITE_LINE_DEVICE_HANDLER( pic_enlg_w )
1714{
1715   //if (state == CLEAR_LINE)
1716   //{
1717   //}
1718}
1719
17081720static I8214_INTERFACE( pic_intf )
17091721{
17101722   DEVCB_DEVICE_LINE("maincpu", pic_int_w),
1711   DEVCB_NULL
1723   DEVCB_DEVICE_LINE("maincpu", pic_enlg_w)
17121724};
17131725
17141726static IRQ_CALLBACK( pc8801_irq_callback )
17151727{
1716   UINT8 vector = (i8214_a_r(device->machine->device("i8214"), 0)); //
1728   UINT8 vector = (7 - i8214_a_r(device->machine->device("i8214"), 0));
17171729
1718   printf("Interrupt Acknowledge Vector: %02x\n", vector);
1719   m_int_state &= ~vector;
1730   m_int_state &= ~(1<<vector);
1731   cputag_set_input_line(device->machine,"maincpu",0,CLEAR_LINE);
17201732
1721   cputag_set_input_line(device->machine,"maincpu", INPUT_LINE_IRQ0, CLEAR_LINE);
1722   i8214_r_w(device->machine->device("i8214"), 0, ~(m_int_state & m_int_mask));
1723
1724   return 1*2;
1733   return vector << 1;
17251734}
17261735
17271736static void pc8801_sound_irq( device_t *device, int irq )
17281737{
1729
1738   pc8801_raise_irq(device->machine,1<<(4),sound_irq_mask);
17301739}
17311740
17321741static TIMER_CALLBACK( pc8801_rtc_irq )
17331742{
1734   //pc8801_raise_irq(machine,2);
1735   //if(m_int_mask & 4)
1736   //   cputag_set_input_line(machine, "maincpu", INPUT_LINE_IRQ0, ASSERT_LINE);
1743   pc8801_raise_irq(machine,1<<(2),timer_irq_mask);
17371744}
17381745
17391746static INTERRUPT_GEN( pc8801_vrtc_irq )
17401747{
1741   pc8801_raise_irq(device->machine,1);
1742   //if(m_int_mask & 2)
1743   //   cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_IRQ0, ASSERT_LINE);
1748   pc8801_raise_irq(device->machine,1<<(1),vblank_irq_mask);
17441749}
17451750
17461751#else
r10198r10199
17631768   }
17641769
17651770   printf("IRQ triggered but no vector on the bus! %02x %02x %02x %02x\n",i8214_irq_level,sound_irq_latch,vrtc_irq_latch,timer_irq_latch);
1766   if(sound_irq_latch)
1767      return 4*2;
17681771
17691772   return 2*2; //TODO: mustn't happen, it does if you press shift on N88-BASIC
17701773}
r10198r10199
17731776{
17741777   if(sound_irq_mask)
17751778   {
1776      sound_irq_latch = 1;
1777      cputag_set_input_line(device->machine,"maincpu",0,HOLD_LINE);
1779      sound_irq_latch = irq;
1780      cputag_set_input_line(device->machine,"maincpu",0,irq);
17781781   }
17791782}
17801783

Previous 15994 Revisions Next


© 1998-2018 The MESS Team