Previous 15994 Revisions Next

r6229 Saturday 31st October, 2009 at 13:38:47 UTC by Harmony
[CDI] Split LCD into a secondary screen, added appropriate default layouts [Carlos]
[CDI] Fixed up CDDA handling, CDDA now plays with popping in The Apprentice [Harmony]
[N64] Inverted Y axis on N64 controller [Harmony]
[IP6] Skeleton driver for SGI "IP6" hardware, presumably 4D/20 [Harmony]
[src/mess]mess.mak messdriv.c
[src/mess/drivers]cdi.c ip6.c* n64.c
[src/mess/layout]cdi.lay*

src/mess/layout/cdi.lay
r0r6229
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <view name="Main Screen Standard (4:3)">
4      <screen index="0">
5         <bounds left="0" top="0" right="4" bottom="3" />
6      </screen>
7   </view>
8   
9   <view name="LCD Standard (15:3)">
10      <screen index="1">
11         <bounds left="0" top="0" right="15" bottom="3" />
12      </screen>
13   </view>
14   
15   <view name="Main Screen Pixel Aspect (~scr0nativexaspect~:~scr0nativeyaspect~)">
16      <screen index="0">
17         <bounds left="0" top="0" right="~scr0width~" bottom="~scr0height~" />
18      </screen>
19   </view>
20   
21   <view name="LCD Pixel Aspect (~scr1nativexaspect~:~scr1nativeyaspect~)">
22      <screen index="1">
23         <bounds left="0" top="0" right="~scr1width~" bottom="~scr1height~" />
24      </screen>
25   </view>
26   
27   <view name="Main Screen + LCD">
28      <screen index="1">
29         <bounds x="0" y="0" width="192" height="22" />
30      </screen>
31      <screen index="0">
32         <bounds x="0" y="22" width="384" height="262" />
33      </screen>
34   </view>
35   
36</mamelayout>
src/mess/messdriv.c
r6228r6229
638638    DRIVER( x68030 )    /* Sharp X68030 (1993)                              */
639639
640640    /* Silicon Graphics */
641    DRIVER( sgi_ip6 )   /* IP6: 4D/PI, R2000, 20MHz                         */
641642    DRIVER( ip204415 )  /* IP20: Indigo 1, R4400, 150MHz                    */
642643    DRIVER( ip225015 )  /* IP22: Indy, R5000, 150MHz                  */
643644    DRIVER( ip224613 )   /* IP22: Indy, R4600, 133MHz                  */
src/mess/mess.mak
r6228r6229
12151215   $(MESS_MACHINE)/sgi.o      \
12161216   $(MESS_DRIVERS)/ip20.o      \
12171217   $(MESS_DRIVERS)/ip22.o      \
1218   $(MESS_DRIVERS)/ip6.o      \
12181219   $(MESS_VIDEO)/newport.o      \
12191220
12201221$(MESSOBJ)/sharp.a:            \
r6228r6229
15431544$(MESS_DRIVERS)/amico2k.o:   $(MESS_LAYOUT)/amico2k.lh
15441545$(MESS_DRIVERS)/beta.o:      $(MESS_LAYOUT)/beta.lh
15451546$(MESS_DRIVERS)/bob85.o:   $(MESS_LAYOUT)/bob85.lh
1547$(MESS_DRIVERS)/cdi.o:      $(MESS_LAYOUT)/cdi.lh
15461548$(MESS_DRIVERS)/coco.o:      $(MESS_LAYOUT)/coco3.lh
15471549$(MESS_DRIVERS)/cosmicos.o:   $(MESS_LAYOUT)/cosmicos.lh
15481550$(MESS_DRIVERS)/c80.o:      $(MESS_LAYOUT)/c80.lh
src/mess/drivers/cdi.c
r6228r6229
3636#include "devices/chd_cd.h"
3737#include "machine/timekpr.h"
3838#include "sound/cdda.h"
39#include "cdi.lh"
3940
4041static UINT16 *planea;
4142static UINT16 *planeb;
r6228r6229
4445static const device_config *dmadac[2];
4546
4647static emu_timer *test_timer;
48static bitmap_t* lcdbitmap;
4749
4850#define ENABLE_UART_PRINTING (0)
4951
5052#define VERBOSE_LEVEL   (5)
5153
52#define ENABLE_VERBOSE_LOG (0)
54#define ENABLE_VERBOSE_LOG (1)
5355
5456#if ENABLE_VERBOSE_LOG
5557INLINE void verboselog(running_machine *machine, int n_level, const char *s_fmt, ...)
r6228r6229
111113static void mcd212_draw_scanline(running_machine *machine, int y);
112114static TIMER_CALLBACK( mcd212_perform_scan );
113115static VIDEO_START(cdi);
116static VIDEO_UPDATE(cdi);
114117
115118// Miscellaneous
116119static TIMER_CALLBACK( test_timer_callback );
r6228r6229
12241227   int bits = 4;
12251228   int index = 0;
12261229   INT16 samples[18*28*16+16];
1227   //FILE* temp_adpcm = fopen("temp_adpcm.bin","ab");
1230   FILE* temp_adpcm = fopen("temp_adpcm.bin","ab");
12281231
12291232   //printf( "%02x\n", hdr[2] & 0x3f );
12301233
r6228r6229
12321235   {
12331236      // Don't play
12341237      //timer_adjust_oneshot(cdic_regs.audio_sample_timer, attotime_never, 0);
1235      //fclose(temp_adpcm);
1238      fclose(temp_adpcm);
12361239      return;
12371240   }
12381241
12391242   verboselog(machine, 0, "cdic_decode_audio_sector, got header type %02x\n", hdr[2] );
12401243
1241   //fseek(temp_adpcm, 0, SEEK_END);
1244   fseek(temp_adpcm, 0, SEEK_END);
12421245   switch(hdr[2] & 0x3f)   // ignore emphasis and reserved bits
12431246   {
12441247      case 0:
r6228r6229
13251328               cdic_decode_xa_stereo(hdr + 4, samples);
13261329               samples[18*28*8 + 0] = samples[18*28*8 + 2] = samples[18*28*8 + 4] = samples[18*28*8 + 6] = samples[18*28*8 + 8] = samples[18*28*8 + 10] = samples[18*28*8 + 12] = samples[18*28*8 + 14] = samples[18*28*8 - 2];
13271330               samples[18*28*8 + 1] = samples[18*28*8 + 3] = samples[18*28*8 + 5] = samples[18*28*8 + 7] = samples[18*28*8 + 9] = samples[18*28*8 + 11] = samples[18*28*8 + 13] = samples[18*28*8 + 15] = samples[18*28*8 - 1];
1328               //fwrite(samples, 1, 18*28*4*cdic_regs.audio_sample_size, temp_adpcm);
1331               fwrite(samples, 1, 18*28*4*cdic_regs.audio_sample_size, temp_adpcm);
13291332               break;
13301333            case 8:
13311334               cdic_decode_xa_stereo8(hdr + 4, samples);
r6228r6229
13381341
13391342    dmadac_transfer(&dmadac[0], 2, 1, 2, 18*28*2*cdic_regs.audio_sample_size, samples);
13401343
1341   //fclose(temp_adpcm);
1344   fclose(temp_adpcm);
13421345}
13431346
13441347// After an appropriate delay for decoding to take place...
13451348static TIMER_CALLBACK( audio_sample_trigger )
13461349{
1347   if(cdic_regs.z_buffer & 0x2000)
1348   {
1349      // Indicate that data has been decoded
1350      verboselog(machine, 0, "Flagging that audio data has been decoded\n" );
1351      cdic_regs.audio_buffer |= 0x8000;
1352   }
1350   // Indicate that data has been decoded
1351   verboselog(machine, 0, "Flagging that audio data has been decoded\n" );
1352   cdic_regs.audio_buffer |= 0x8000;
13531353
13541354   // Set the CDIC interrupt line
13551355   verboselog(machine, 0, "Setting CDIC interrupt line for soundmap decode\n" );
r6228r6229
13671367
13681368      // Swap buffer positions to indicate our new buffer position at the next read
13691369      cdic_regs.z_buffer ^= 0x1a00;
1370      cdic_regs.data_buffer ^= 0x0001;
13701371
13711372      verboselog(machine, 0, "Updated cdic_regs.z_buffer, new value is %04x\n", cdic_regs.z_buffer );
13721373
r6228r6229
13801381   {
13811382      // Swap buffer positions to indicate our new buffer position at the next read
13821383      cdic_regs.z_buffer ^= 0x1a00;
1384      cdic_regs.z_buffer &= 0xfffe;
13831385      verboselog(machine, 0, "Data is not valid, stopping playback\n" );
13841386      timer_adjust_oneshot(cdic_regs.audio_sample_timer, attotime_never, 0);
13851387   }
13861388}
13871389
1388static UINT32 increment_cdda_bcd(UINT32 bcd)
1390static UINT32 increment_cdda_frame_bcd(UINT32 bcd)
13891391{
13901392   UINT8 nybbles[6] =
13911393   {
r6228r6229
13961398      (bcd & 0x000f0000) >> 16,
13971399      (bcd & 0x00f00000) >> 20
13981400   };
1401   nybbles[0]++;
1402   if(nybbles[0] == 5 && nybbles[1] == 7)
1403   {
1404      nybbles[0] = 0;
1405      nybbles[1] = 0;
1406      nybbles[2]++;
1407   }
1408   else if(nybbles[0] == 10)
1409   {
1410      nybbles[1]++;
1411   }
1412   if(nybbles[2] == 10)
1413   {
1414      nybbles[3]++;
1415      nybbles[2] = 0;
1416   }
1417   if(nybbles[3] == 6)
1418   {
1419      nybbles[4]++;
1420      nybbles[3] = 0;
1421   }
1422   if(nybbles[4] == 10)
1423   {
1424      nybbles[5]++;
1425      nybbles[4] = 0;
1426   }
1427   return (nybbles[5] << 20) | (nybbles[4] << 16) | (nybbles[3] << 12) | (nybbles[2] << 8) | (nybbles[1] << 4) | nybbles[0];
1428}
1429
1430static UINT32 increment_cdda_sector_bcd(UINT32 bcd)
1431{
1432   UINT8 nybbles[6] =
1433   {
1434       bcd & 0x0000000f,
1435      (bcd & 0x000000f0) >> 4,
1436      (bcd & 0x00000f00) >> 8,
1437      (bcd & 0x0000f000) >> 12,
1438      (bcd & 0x000f0000) >> 16,
1439      (bcd & 0x00f00000) >> 20
1440   };
13991441   nybbles[2]++;
14001442   if(nybbles[2] == 10)
14011443   {
r6228r6229
15021544            }
15031545         }
15041546
1547         cdic_regs.data_buffer ^= 0x0001;
1548
15051549         //printf( "%02x\n", buffer[CDIC_SECTOR_SUBMODE2] );
15061550         if((buffer[CDIC_SECTOR_FILE2] << 8) == cdic_regs.file)
15071551         {
1508            if(((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_FORM | CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == (CDIC_SUBMODE_FORM | CDIC_SUBMODE_AUDIO)) &&
1509               (cdic_regs.channel & cdic_regs.audio_channel & (1 << buffer[CDIC_SECTOR_CHAN2])))
1552            if(cdic_regs.channel & (1 << buffer[CDIC_SECTOR_CHAN2]))
15101553            {
1554               if(((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_FORM | CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == (CDIC_SUBMODE_FORM | CDIC_SUBMODE_AUDIO)) &&
1555                  (cdic_regs.audio_channel & (1 << buffer[CDIC_SECTOR_CHAN2])))
15111556               {
1512                   verboselog(machine, 0, "Audio sector\n" );
1557                  {
1558                      verboselog(machine, 0, "Audio sector\n" );
15131559
1560                     //cdic_regs.data_buffer ^= 0x0001;
1561
1562                     cdic_regs.x_buffer |= 0x8000;
1563                     cdic_regs.data_buffer |= 0x4000;
1564                     cdic_regs.data_buffer |= 0x0004;
1565
1566                     for(index = 6; index < 2352/2; index++)
1567                     {
1568                        cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
1569                     }
1570
1571                     cdic_decode_audio_sector(machine, ((UINT8*)cdram) + ((cdic_regs.data_buffer & 5) * 0xa00 + 4), 0);
1572
1573                     //printf( "Setting CDIC interrupt line\n" );
1574                     verboselog(machine, 0, "Setting CDIC interrupt line for audio sector\n" );
1575                     cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
1576                     cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE);
1577                  }
1578               }
1579               else if((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == 0x00)
1580               {
1581                  //cdic_regs.data_buffer ^= 0x0001;
1582
1583                  if((buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_TRIG) == CDIC_SUBMODE_TRIG ||
1584                     (buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOR) == CDIC_SUBMODE_EOR ||
1585                     (buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == CDIC_SUBMODE_EOF)
1586                  {
1587                     cdic_regs.data_buffer &= ~0x0004;
1588                     cdic_regs.x_buffer |= 0x8000;
1589                     cdic_regs.data_buffer |= 0x4000;
1590
1591                     for(index = 6; index < 2352/2; index++)
1592                     {
1593                        cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
1594                     }
1595
1596                     //printf( "Setting CDIC interrupt line\n" );
1597                     verboselog(machine, 0, "Setting CDIC interrupt line for message sector\n" );
1598                     cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
1599                     cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE);
1600                  }
1601                  else
1602                  {
1603                     verboselog(machine, 0, "Message sector, ignored\n" );
1604                  }
1605               }
1606               else /*if(buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_DATA | CDIC_SUBMODE_VIDEO))*/
1607               {
1608                  //cdic_regs.data_buffer ^= 0x0001;
1609
1610                  cdic_regs.data_buffer &= ~0x0004;
15141611                  cdic_regs.x_buffer |= 0x8000;
15151612                  cdic_regs.data_buffer |= 0x4000;
1516                  cdic_regs.data_buffer |= 0x0004;
1517                  cdic_regs.data_buffer ^= 0x0001;
15181613
15191614                  for(index = 6; index < 2352/2; index++)
15201615                  {
15211616                     cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
15221617                  }
15231618
1524                  cdic_decode_audio_sector(machine, ((UINT8*)cdram) + ((cdic_regs.data_buffer & 5) * 0xa00 + 4), 0);
1525
15261619                  //printf( "Setting CDIC interrupt line\n" );
1527                  verboselog(machine, 0, "Setting CDIC interrupt line for audio sector\n" );
1620                  verboselog(machine, 0, "Setting CDIC interrupt line for data sector\n" );
15281621                  cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
15291622                  cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE);
1530               //}
15311623               }
15321624            }
1533            else if((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == 0x00)
1534            {
1535               cdic_regs.data_buffer &= ~0x0004;
1536               cdic_regs.x_buffer |= 0x8000;
1537               cdic_regs.data_buffer |= 0x4000;
1538               cdic_regs.data_buffer ^= 0x0001;
15391625
1540               for(index = 6; index < 2352/2; index++)
1541               {
1542                  cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
1543               }
1544
1545               if((buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_TRIG) == CDIC_SUBMODE_TRIG ||
1546                  (buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOR) == CDIC_SUBMODE_EOR ||
1547                  (buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == CDIC_SUBMODE_EOF)
1548               {
1549                  //printf( "Setting CDIC interrupt line\n" );
1550                  verboselog(machine, 0, "Setting CDIC interrupt line for message sector\n" );
1551                  cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
1552                  cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE);
1553               }
1554               else
1555               {
1556                  verboselog(machine, 0, "Message sector, ignored\n" );
1557               }
1558            }
1559            else /*if(buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_DATA | CDIC_SUBMODE_VIDEO))*/
1560            {
1561               cdic_regs.data_buffer &= ~0x0004;
1562               cdic_regs.x_buffer |= 0x8000;
1563               cdic_regs.data_buffer |= 0x4000;
1564               cdic_regs.data_buffer ^= 0x0001;
1565
1566               for(index = 6; index < 2352/2; index++)
1567               {
1568                  cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
1569               }
1570
1571               //printf( "Setting CDIC interrupt line\n" );
1572               verboselog(machine, 0, "Setting CDIC interrupt line for data sector\n" );
1573               cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
1574               cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE);
1575            }
1576
15771626            if((buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == 0 && cdic_regs.command != 0x23)
15781627            {
15791628               timer_adjust_oneshot(cdic_regs.interrupt_timer, ATTOTIME_IN_HZ(75), 0); // 75Hz = 1x CD-ROM speed
r6228r6229
15891638
15901639         break;
15911640      }
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;
15921650      case 0x24: // Mode 2 Reset
15931651      case 0x2e: // Abort
1594         timer_adjust_oneshot(cdic_regs.interrupt_timer, ATTOTIME_IN_HZ(75), 0); // 75Hz = 1x CD-ROM speed
1652         timer_adjust_oneshot(cdic_regs.interrupt_timer, attotime_never, 0);
1653         cdic_regs.data_buffer &= ~4;
15951654         break;
15961655      case 0x28: // Play CDDA audio
15971656      {
1598         UINT32 msf = (cdic_regs.time & 0xffff0000) >> 8;
1599         UINT32 next_msf = increment_cdda_bcd((cdic_regs.time & 0xffff0000) >> 8);
1657         UINT8 buffer[2560] = { 0 };
1658         int index = 0;
1659         UINT32 msf = (cdic_regs.time & 0xffff7f00) >> 8;
1660         UINT32 next_msf = increment_cdda_frame_bcd((cdic_regs.time & 0xffff7f00) >> 8);
1661         UINT32 rounded_next_msf = increment_cdda_sector_bcd((cdic_regs.time & 0xffff0000) >> 8);
16001662         UINT32 lba = 0;
16011663         UINT32 next_lba = 0;
16021664         UINT8 nybbles[6] =
r6228r6229
16101672         };
16111673         UINT8 next_nybbles[6] =
16121674         {
1613             next_msf & 0x0000000f,
1614            (next_msf & 0x000000f0) >> 4,
1615            (next_msf & 0x00000f00) >> 8,
1616            (next_msf & 0x0000f000) >> 12,
1617            (next_msf & 0x000f0000) >> 16,
1618            (next_msf & 0x00f00000) >> 20
1675             rounded_next_msf & 0x0000000f,
1676            (rounded_next_msf & 0x000000f0) >> 4,
1677            (rounded_next_msf & 0x00000f00) >> 8,
1678            (rounded_next_msf & 0x0000f000) >> 12,
1679            (rounded_next_msf & 0x000f0000) >> 16,
1680            (rounded_next_msf & 0x00f00000) >> 20
16191681         };
16201682         cdic_regs.time = next_msf << 8;
1621         if(msf & 0x000080)
1622         {
1623            msf &= 0xffff00;
1624            nybbles[0] = 0;
1625            nybbles[1] = 0;
1626         }
1627         if(nybbles[2] >= 2)
1628         {
1629            nybbles[2] -= 2;
1630         }
1631         else
1632         {
1633            nybbles[2] = 8 + nybbles[2];
1634            if(nybbles[3] > 0)
1635            {
1636               nybbles[3]--;
1637            }
1638            else
1639            {
1640               nybbles[3] = 5;
1641               if(nybbles[4] > 0)
1642               {
1643                  nybbles[4]--;
1644               }
1645               else
1646               {
1647                  nybbles[4] = 9;
1648                  nybbles[5]--;
1649               }
1650            }
1651         }
16521683         lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60);
1653         if(next_nybbles[2] >= 2)
1684
1685         cdrom_read_data(cdic_regs.cd, lba, buffer, CD_TRACK_RAW_DONTCARE);
1686
1687         if(!(msf & 0x0000ff))
16541688         {
1655            next_nybbles[2] -= 2;
1689            next_lba = next_nybbles[0] + next_nybbles[1]*10 + ((next_nybbles[2] + next_nybbles[3]*10)*75) + ((next_nybbles[4] + next_nybbles[5]*10)*75*60);
1690
1691            verboselog(machine, 0, "Playing CDDA sector from MSF location %06x\n", cdic_regs.time | 2 );
1692
1693            cdda_start_audio(devtag_get_device(machine, "cdda"), lba, rounded_next_msf);
1694
16561695         }
1657         else
1658         {
1659            next_nybbles[2] = 8 + next_nybbles[2];
1660            if(next_nybbles[3] > 0)
1661            {
1662               next_nybbles[3]--;
1663            }
1664            else
1665            {
1666               next_nybbles[3] = 5;
1667               if(next_nybbles[4] > 0)
1668               {
1669                  next_nybbles[4]--;
1670               }
1671               else
1672               {
1673                  next_nybbles[4] = 9;
1674                  next_nybbles[5]--;
1675               }
1676            }
1677         }
16781696
1679         next_lba = next_nybbles[0] + next_nybbles[1]*10 + ((next_nybbles[2] + next_nybbles[3]*10)*75) + ((next_nybbles[4] + next_nybbles[5]*10)*75*60);
1697         timer_adjust_oneshot(cdic_regs.interrupt_timer, ATTOTIME_IN_HZ(75), 0);
16801698
1681         verboselog(machine, 0, "Playing CDDA sector from MSF location %06x\n", cdic_regs.time | 2 );
1699         cdic_regs.x_buffer |= 0x8000;
1700         cdic_regs.data_buffer |= 0x4000;
16821701
1683         cdda_start_audio(devtag_get_device(machine, "cdda"), lba, next_lba);
1702         for(index = 6; index < 2352/2; index++)
1703         {
1704            cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
1705         }
16841706
1685         timer_adjust_oneshot(cdic_regs.interrupt_timer, ATTOTIME_IN_HZ(1), 0);
1686
16871707         verboselog(machine, 0, "Setting CDIC interrupt line for CDDA sector\n" );
16881708         cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
16891709         cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE);
r6228r6229
18661886         COMBINE_DATA(&cdic_regs.z_buffer);
18671887         if(cdic_regs.z_buffer & 0x2000)
18681888         {
1869            attotime period = timer_timeleft(cdic_regs.interrupt_timer);
1889            attotime period = timer_timeleft(cdic_regs.audio_sample_timer);
18701890            if(!attotime_is_never(period))
18711891            {
18721892               timer_adjust_oneshot(cdic_regs.audio_sample_timer, period, 0);
r6228r6229
18961916            {
18971917               case 0x24: // Reset Mode 2
18981918               case 0x2e: // Abort
1919               {
18991920                  timer_adjust_oneshot(cdic_regs.interrupt_timer, attotime_never, 0);
19001921                  dmadac_enable(&dmadac[0], 2, 0);
1922                  cdic_regs.data_buffer &= 0xbfff;
19011923                  break;
1924               }
1925               case 0x2b: // Stop CDDA
1926                  cdda_stop_audio(devtag_get_device(space->machine, "cdda"));
1927                  timer_adjust_oneshot(cdic_regs.interrupt_timer, attotime_never, 0);
1928                  break;
19021929               case 0x23: // Reset Mode 1
19031930               case 0x29: // Read Mode 1
19041931               case 0x2a: // Read Mode 2
1905                  timer_adjust_oneshot(cdic_regs.interrupt_timer, ATTOTIME_IN_HZ(75), 0); // 75Hz = 1x CD-ROM speed
1906                  break;
19071932               case 0x28: // Play CDDA
1908                  //timer_adjust_oneshot(cdic_regs.interrupt_timer, attotime_zero, 0);
1909                  //cdic_regs.data_buffer &= 0x3fff;
1910                  break;
1911               case 0x2b: // Stop CDDA
1912                  cdda_stop_audio(devtag_get_device(space->machine, "cdda"));
1913                  timer_adjust_oneshot(cdic_regs.interrupt_timer, attotime_never, 0);
1914                  break;
19151933               case 0x2c: // Seek
1934               {
1935                  attotime period = timer_timeleft(cdic_regs.interrupt_timer);
1936                  if(!attotime_is_never(period))
1937                  {
1938                     timer_adjust_oneshot(cdic_regs.interrupt_timer, period, 0);
1939                  }
1940                  else
1941                  {
1942                     timer_adjust_oneshot(cdic_regs.interrupt_timer, ATTOTIME_IN_HZ(75), 0);
1943                  }
19161944                  break;
1945               }
19171946               default:
19181947                  verboselog(space->machine, 0, "Unknown CDIC command: %02x\n", cdic_regs.command );
19191948                  break;
r6228r6229
19822011}
19832012
19842013static void perform_mouse_update(running_machine *machine)
2014
19852015{
19862016   UINT16 x = input_port_read(machine, "MOUSEX");
19872017   UINT16 y = input_port_read(machine, "MOUSEY");
r6228r6229
24552485
24562486static void cdi220_draw_lcd(running_machine *machine, int y)
24572487{
2458   bitmap_t *bitmap = tmpbitmap;
2488   bitmap_t *bitmap = lcdbitmap;
24592489   UINT32 *scanline = BITMAP_ADDR32(bitmap, y, 0);
24602490   int x = 0;
24612491   int lcd = 0;
r6228r6229
24742504         }
24752505      }
24762506   }
2477   for(x = 8*24; x < 384; x++)
2478   {
2479      scanline[x] = 0;
2480   }
24812507}
24822508
24832509static READ16_HANDLER(mcd212_r)
r6228r6229
38783904   mcd212.channel[1].clut_bank = 0;
38793905   mcd212.scan_timer = timer_alloc(machine, mcd212_perform_scan, 0);
38803906   timer_adjust_oneshot(mcd212.scan_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0);
3907
3908   lcdbitmap = video_screen_auto_bitmap_alloc(devtag_get_device(machine, "lcd"));
38813909}
38823910
3911static VIDEO_UPDATE(cdi)
3912{
3913   const device_config *main_screen = devtag_get_device(screen->machine, "screen");
3914   const device_config *lcd_screen = devtag_get_device(screen->machine, "lcd");
3915
3916   if (screen == main_screen)
3917   {
3918      copybitmap(bitmap, tmpbitmap, 0, 0, 0, 0, cliprect);
3919   }
3920   else if (screen == lcd_screen)
3921   {
3922      copybitmap(bitmap, lcdbitmap, 0, 0, 0, 0, cliprect);
3923   }
3924
3925   return 0;
3926}
3927
38833928static TIMER_CALLBACK( test_timer_callback )
38843929{
38853930   // This function manually triggers interrupt requests as a test.
r6228r6229
39493994   PORT_START("MOUSEBTN")
39503995   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CHANGED(mouse_update, 0)
39513996   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Button 2") PORT_CHANGED(mouse_update, 0)
3952   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_CODE(MOUSECODE_BUTTON3) PORT_NAME("Mouse Button 3") PORT_CHANGED(mouse_update, 0)
3953   PORT_BIT(0xf8, IP_ACTIVE_HIGH, IPT_UNUSED)
3997   PORT_BIT(0xfc, IP_ACTIVE_HIGH, IPT_UNUSED)
39543998INPUT_PORTS_END
39553999
39564000static MACHINE_RESET( cdi )
r6228r6229
40154059   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
40164060   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
40174061   MDRV_SCREEN_SIZE(384, 262)
4018   MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 262-1) //dynamic resolution,TODO
4062   MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 22, 262-1) //dynamic resolution,TODO
40194063
4064   MDRV_SCREEN_ADD("lcd", RASTER)
4065   MDRV_SCREEN_REFRESH_RATE(60)
4066   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
4067   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
4068   MDRV_SCREEN_SIZE(192, 22)
4069   MDRV_SCREEN_VISIBLE_AREA(0, 192-1, 0, 22-1)
4070
40204071   MDRV_PALETTE_LENGTH(0x100)
40214072
4073   MDRV_DEFAULT_LAYOUT(layout_cdi)
4074
40224075   MDRV_VIDEO_START(cdi)
4023   MDRV_VIDEO_UPDATE(generic_bitmapped)
4076   MDRV_VIDEO_UPDATE(cdi)
40244077
40254078   MDRV_MACHINE_RESET(cdi)
40264079
src/mess/drivers/ip6.c
r0r6229
1/*********************************************************************\
2*
3*   SGI IP6 4D/PI workstation
4*
5*   Skeleton driver by Harmony
6*
7*   Todo: Everything
8*
9*   Preliminary Memory map:
10*
11*    1fc00000 - 1fc3ffff      BIOS
12*
13\*********************************************************************/
14
15#include "driver.h"
16#include "cpu/mips/r3000.h"
17
18#define VERBOSE_LEVEL ( 99 )
19
20INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, const char *s_fmt, ... )
21{
22   if( VERBOSE_LEVEL >= n_level )
23   {
24      va_list v;
25      char buf[ 32768 ];
26      va_start( v, s_fmt );
27      vsprintf( buf, s_fmt, v );
28      va_end( v );
29      logerror("%08x: %s", cpu_get_pc(cputag_get_cpu(machine, "maincpu")), buf);
30   }
31}
32
33typedef struct
34{
35   UINT16 unknown_half_0;
36   UINT8 unknown_byte_0;
37   UINT8 unknown_byte_1;
38} ip6_regs_t;
39
40static ip6_regs_t ip6_regs;
41
42static READ32_HANDLER( ip6_unk1_r )
43{
44   UINT32 ret = 0;
45   switch(offset)
46   {
47      case 0x0000/4:
48         if(ACCESSING_BITS_16_31)
49         {
50            verboselog(space->machine, 0, "ip6_unk1_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
51         }
52         if(ACCESSING_BITS_0_15)
53         {
54            verboselog(space->machine, 0, "ip6_unk1_r: Unknown Halfword 0: %08x & %08x\n", ip6_regs.unknown_half_0, mem_mask );
55            ret |= ip6_regs.unknown_half_0;
56         }
57         break;
58      default:
59         verboselog(space->machine, 0, "ip6_unk1_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
60         break;
61   }
62   return ret;
63}
64
65static WRITE32_HANDLER( ip6_unk1_w )
66{
67   switch(offset)
68   {
69      case 0x0000/4:
70         if(ACCESSING_BITS_16_31)
71         {
72            verboselog(space->machine, 0, "ip6_unk1_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
73         }
74         if(ACCESSING_BITS_0_15)
75         {
76            verboselog(space->machine, 0, "ip6_unk1_w: Unknown Halfword 0 = %04x & %04x\n", data & 0x0000ffff, mem_mask & 0x0000ffff );
77            ip6_regs.unknown_half_0 = data & 0x0000ffff;
78         }
79         break;
80      default:
81         verboselog(space->machine, 0, "ip6_unk1_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
82         break;
83   }
84}
85
86static READ32_HANDLER( ip6_unk2_r )
87{
88   UINT32 ret = 0;
89   switch(offset)
90   {
91      case 0x0000/4:
92         if(!ACCESSING_BITS_24_31)
93         {
94            verboselog(space->machine, 0, "ip6_unk2_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
95         }
96         if(ACCESSING_BITS_24_31)
97         {
98            verboselog(space->machine, 0, "ip6_unk2_r: Unknown Byte 0 = %02x & %02x\n", ip6_regs.unknown_byte_0, mem_mask >> 24 );
99            ret |= ip6_regs.unknown_byte_0 << 24;
100         }
101         break;
102      default:
103         verboselog(space->machine, 0, "ip6_unk2_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
104         break;
105   }
106   return ret;
107}
108
109static WRITE32_HANDLER( ip6_unk2_w )
110{
111   switch(offset)
112   {
113      case 0x0000/4:
114         if(!ACCESSING_BITS_24_31)
115         {
116            verboselog(space->machine, 0, "ip6_unk2_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
117         }
118         if(ACCESSING_BITS_24_31)
119         {
120            verboselog(space->machine, 0, "ip6_unk2_w: Unknown Byte 0 = %02x & %02x\n", data >> 24, mem_mask >> 24 );
121            ip6_regs.unknown_byte_0 = (data & 0xff000000) >> 24;
122         }
123         break;
124      default:
125         verboselog(space->machine, 0, "ip6_unk2_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
126         break;
127   }
128}
129
130static READ32_HANDLER(ip6_unk3_r)
131{
132   UINT32 ret = 0;
133   if(ACCESSING_BITS_16_23)
134   {
135      verboselog(space->machine, 0, "ip6_unk3_r: Unknown Byte 1: %02x & %02x\n", ip6_regs.unknown_byte_1, (mem_mask >> 16) & 0x000000ff);
136      ret |= ip6_regs.unknown_byte_1 << 16;
137   }
138   else
139   {
140      verboselog(space->machine, 0, "ip6_unk3_r: Unknown address: %08x & %08x\n", 0x1fb00000 + (offset << 2), mem_mask );
141   }
142   return ret;
143}
144
145static WRITE32_HANDLER(ip6_unk3_w)
146{
147   verboselog(space->machine, 0, "ip6_unk3_w: Unknown address: %08x = %08x & %08x\n", 0x1fb00000 + (offset << 2), data, mem_mask );
148}
149
150static ADDRESS_MAP_START( sgi_ip6_map, ADDRESS_SPACE_PROGRAM, 32 )
151   AM_RANGE( 0x1f880000, 0x1f880003 ) AM_READWRITE(ip6_unk1_r, ip6_unk1_w)
152   AM_RANGE( 0x1fb00000, 0x1fb00003 ) AM_READWRITE(ip6_unk3_r, ip6_unk3_w)
153   AM_RANGE( 0x1fbc004c, 0x1fbc004f ) AM_READWRITE(ip6_unk2_r, ip6_unk2_w)
154   AM_RANGE( 0x1fc00000, 0x1fc3ffff ) AM_ROM AM_REGION( "user1", 0 )
155ADDRESS_MAP_END
156
157static MACHINE_START( sgi_ip6 )
158{
159}
160
161static MACHINE_RESET( sgi_ip6 )
162{
163   ip6_regs.unknown_byte_0 = 0x80;
164   ip6_regs.unknown_byte_1 = 0x80;
165   ip6_regs.unknown_half_0 = 0;
166}
167
168static DRIVER_INIT( sgi_ip6 )
169{
170}
171
172static INPUT_PORTS_START( sgi_ip6 )
173   PORT_START("UNUSED") // unused IN0
174   PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED)
175INPUT_PORTS_END
176
177static INTERRUPT_GEN( sgi_ip6_vbl )
178{
179}
180
181static const r3000_cpu_core config =
182{
183   0,      /* 1 if we have an FPU, 0 otherwise */
184   4096,   /* code cache size */
185   4096   /* data cache size */
186};
187
188static MACHINE_DRIVER_START( sgi_ip6 )
189   MDRV_CPU_ADD( "maincpu", R3000BE, 20000000 ) // FIXME: Should be R2000
190   MDRV_CPU_CONFIG( config )
191   MDRV_CPU_PROGRAM_MAP( sgi_ip6_map )
192   MDRV_CPU_VBLANK_INT("screen", sgi_ip6_vbl)
193
194   MDRV_MACHINE_RESET( sgi_ip6 )
195
196   /* video hardware */
197   MDRV_SCREEN_ADD("screen", RASTER)
198   MDRV_SCREEN_REFRESH_RATE( 60 )
199   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
200   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
201   MDRV_SCREEN_SIZE(640, 480)
202   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
203
204   MDRV_MACHINE_START( sgi_ip6 )
205
206   MDRV_VIDEO_START(generic_bitmapped)
207   MDRV_VIDEO_UPDATE(generic_bitmapped)
208MACHINE_DRIVER_END
209
210ROM_START( sgi_ip6 )
211   ROM_REGION32_BE( 0x40000, "user1", 0 )
212   ROM_LOAD( "4d202031.bin", 0x000000, 0x040000, CRC(12345678) SHA1(1234567812345678123456781234567812345678) )
213ROM_END
214
215/*     YEAR  NAME      PARENT    COMPAT    MACHINE   INPUT     INIT      CONFIG    COMPANY   FULLNAME */
216COMP( 1988, sgi_ip6,  0,        0,        sgi_ip6,  sgi_ip6,  sgi_ip6,  0, "Silicon Graphics, Inc", "4D/PI (R2000, 20MHz)", GAME_NOT_WORKING )
src/mess/drivers/n64.c
r6228r6229
44    Driver by Ville Linde
55    Reformatted to share hardware by R. Belmont
66    Additional work by Ryan Holtz
7    Porting from Mupen64 by Harmony
78*/
89
910#include "driver.h"
r6228r6229
5859      PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
5960
6061   PORT_START("P1_ANALOG_Y")
61      PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0xff,0x00) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
62      PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) PORT_REVERSE
6263INPUT_PORTS_END
6364
6465/* ?? */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team