Previous 15994 Revisions Next

r6231 Saturday 31st October, 2009 at 17:52:21 UTC by Harmony
[CDI] Hooking up prototype CDIC Seek (0x2C) command support. This allows International Tennis Open and Flashback to boot, though Flashback suffers from other issues. [Harmony]
[src/mess/drivers]cdi.c

src/mess/drivers/cdi.c
r6230r6231
14641464      case 0x23: // Reset Mode 1
14651465      case 0x29: // Read Mode 1
14661466      case 0x2a: // Read Mode 2
1467      //case 0x2c: // Seek
14671468      {
14681469         UINT8 buffer[2560] = { 0 };
14691470         UINT32 msf = cdic_regs.time >> 8;
r6230r6231
16381639
16391640         break;
16401641      }
1641      case 0x2c: // Seek
1642         timer_adjust_oneshot(cdic_regs.interrupt_timer, attotime_never, 0);
1643
1644         cdic_regs.data_buffer &= ~4;
1645
1646         verboselog(machine, 0, "Setting CDIC interrupt line for data sector\n" );
1647         cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
1648         cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE);
1649         break;
16501642      case 0x24: // Mode 2 Reset
16511643      case 0x2e: // Abort
16521644         timer_adjust_oneshot(cdic_regs.interrupt_timer, attotime_never, 0);
r6230r6231
17091701         cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE);
17101702         break;
17111703      }
1704      case 0x2c: // Seek
1705      {
1706         UINT8 buffer[2560] = { 0 };
1707         int index = 0;
1708         UINT32 msf = (cdic_regs.time & 0xffff7f00) >> 8;
1709         UINT32 next_msf = increment_cdda_frame_bcd((cdic_regs.time & 0xffff7f00) >> 8);
1710         UINT32 lba = 0;
1711         UINT8 nybbles[6] =
1712         {
1713             msf & 0x0000000f,
1714            (msf & 0x000000f0) >> 4,
1715            (msf & 0x00000f00) >> 8,
1716            (msf & 0x0000f000) >> 12,
1717            (msf & 0x000f0000) >> 16,
1718            (msf & 0x00f00000) >> 20
1719         };
1720         lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60);
1721
1722         timer_adjust_oneshot(cdic_regs.interrupt_timer, ATTOTIME_IN_HZ(75), 0);
1723
1724         cdrom_read_data(cdic_regs.cd, lba, buffer, CD_TRACK_RAW_DONTCARE);
1725
1726         cdic_regs.data_buffer ^= 0x0001;
1727         cdic_regs.x_buffer |= 0x8000;
1728         cdic_regs.data_buffer |= 0x4000;
1729
1730         for(index = 6; index < 2352/2; index++)
1731         {
1732            cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
1733         }
1734
1735         cdram[0x924/2] = 0x0041;                        //   CTRL
1736         cdram[0x926/2] = 0x0001;                         //  TRACK
1737         cdram[0x928/2] = 0x0000;                        //    INDEX
1738         cdram[0x92a/2] = (cdic_regs.time >> 24) & 0x000000ff;   //    MIN
1739         cdram[0x92c/2] = (cdic_regs.time >> 16) & 0x000000ff;   //    SEC
1740         cdram[0x92e/2] = (cdic_regs.time >>  8) & 0x0000007f;   //    FRAC
1741         cdram[0x930/2] = 0x0000;                        //  ZERO
1742         cdram[0x932/2] = (cdic_regs.time >> 24) & 0x000000ff;   //    AMIN
1743         cdram[0x934/2] = (cdic_regs.time >> 16) & 0x000000ff;   //    ASEC
1744         cdram[0x936/2] = (cdic_regs.time >>  8) & 0x0000007f;   //    AFRAC
1745         cdram[0x938/2] = 0x0000;                        //  CRC1
1746         cdram[0x93a/2] = 0x0000;                        //  CRC2
1747
1748         cdic_regs.time = next_msf << 8;
1749
1750         verboselog(machine, 0, "Setting CDIC interrupt line for Seek sector\n" );
1751         cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
1752         cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE);
1753         break;
1754      }
17121755   }
17131756}
17141757
r6230r6231
19331976               case 0x2c: // Seek
19341977               {
19351978                  attotime period = timer_timeleft(cdic_regs.interrupt_timer);
1979                  //if(cdic_regs.command == 0x2c)
1980                  //{
1981                  //   cdic_regs.time &= 0xffff0000;
1982                  //}
19361983                  if(!attotime_is_never(period))
19371984                  {
19381985                     timer_adjust_oneshot(cdic_regs.interrupt_timer, period, 0);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team