Previous 199869 Revisions Next

r19379 Friday 7th December, 2012 at 14:06:12 UTC by David Haywood
Also reset the YM2610 when resetting the Z80, seems to avoid some lost sounds in neocdz crsword2 + misc cleanups (nw)
[hash]neocd.xml
[src/mame/includes]neogeo.h
[src/mame/video]neogeo.c
[src/mess/drivers]ng_aes.c

trunk/hash/neocd.xml
r19378r19379
138138    </part>
139139  </software>
140140
141  <!-- disable most things for now, until I actually get it working -->
142  <!--
143141  <software name="2020bb">
144142     <description>2020 Super Baseball (1995)(SNK)(JP-US)[!]</description>
145143     <year>199?</year>
r19378r19379
11601158     </part>
11611159  </software>
11621160
1163  -->
1164
11651161</softwarelist>
trunk/src/mess/drivers/ng_aes.c
r19378r19379
125125   DECLARE_WRITE16_MEMBER(neocd_memcard_w);
126126   DECLARE_READ16_MEMBER(neocd_control_r);
127127   DECLARE_WRITE16_MEMBER(neocd_control_w);
128   DECLARE_READ16_MEMBER(neocd_transfer_r);
129   DECLARE_WRITE16_MEMBER(neocd_transfer_w);
128   DECLARE_READ8_MEMBER(neocd_transfer_r);
129   DECLARE_WRITE8_MEMBER(neocd_transfer_w);
130130   DECLARE_READ16_MEMBER(aes_in0_r);
131131   DECLARE_READ16_MEMBER(aes_in1_r);
132132   DECLARE_READ16_MEMBER(aes_in2_r);
r19378r19379
271271
272272
273273
274UINT8 ng_aes_state::neogeoReadTransfer(UINT32 sekAddress, int is_byte_transfer)
275{
276//  if ((sekAddress & 0x0FFFFF) < 16)
277//      printf(PRINT_NORMAL, _T("  - NGCD port 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
278274
279   sekAddress ^= 1;
280275
281   switch (nActiveTransferArea) {
282      case 0:                     // Sprites
283         return NeoSpriteRAM[nSpriteTransferBank + (sekAddress & 0x0FFFFF)];
284         break;
285      case 1:                     // ADPCM
286         return YM2610ADPCMAROM[nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)];
287         break;
288      case 4:                     // Z80
289         if ((sekAddress & 0xfffff) >= 0x20000) break;
290         return NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1];
291         break;
292      case 5:                     // Text
293         return NeoTextRAM[(sekAddress & 0x3FFFF) >> 1];
294         break;
295   }
296276
297   return ~0;
298}
299277
300278
301void ng_aes_state::neogeoWriteTransfer(UINT32 sekAddress, UINT8 byteValue, int is_byte_transfer)
302{
303//  if ((sekAddress & 0x0FFFFF) < 16)
304//      bprintf(PRINT_NORMAL, _T("  - Transfer: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1));
305
306   if (!nTransferWriteEnable) {
307//      return;
308   }
309   int address;
310
311   // why, is our DMA broken?
312   sekAddress ^= 1;
313
314   switch (nActiveTransferArea) {
315      case 0:                     // Sprites
316         address = (nSpriteTransferBank + (sekAddress & 0x0FFFFF));
317
318         if ((address&3)==0) NeoSpriteRAM[address] = byteValue;
319         if ((address&3)==1) NeoSpriteRAM[address^3] = byteValue;
320         if ((address&3)==2) NeoSpriteRAM[address^3] = byteValue;
321         if ((address&3)==3) NeoSpriteRAM[address] = byteValue;
322
323         //  NeoCDOBJBankUpdate[nSpriteTransferBank >> 20] = true;
324         break;
325      case 1:                     // ADPCM
326         YM2610ADPCMAROM[nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = byteValue;
327         break;
328      case 4:                     // Z80
329         if ((sekAddress & 0xfffff) >= 0x20000) break;
330
331         if (!is_byte_transfer)
332         {
333            if (((sekAddress & 0xfffff) >= 0x20000) || nNeoCDZ80ProgWriteWordCancelHack) break;
334            if (sekAddress == 0xe1fdf2) nNeoCDZ80ProgWriteWordCancelHack = 1;
335         }
336
337         NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1] = byteValue;
338         break;
339      case 5:                     // Text
340         NeoTextRAM[(sekAddress & 0x3FFFF) >> 1] = byteValue;
341//          NeoUpdateTextOne((sekAddress & 0x3FFFF) >> 1, byteValue);
342         break;
343   }
344}
345
346
347
348
349
350
351279READ16_MEMBER(ng_aes_state::neocd_control_r)
352280{
353281   UINT32 sekAddress = 0xff0000+ (offset*2);
r19378r19379
449377
450378      case 0x0120:
451379//          bprintf(PRINT_NORMAL, _T("  - NGCD OBJ BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1));
380         m_has_sprite_bus = false;
452381         break;
453382      case 0x0122:
454383//          bprintf(PRINT_NORMAL, _T("  - NGCD PCM BUSREQ -> 1 (PC: 0x%06X) %x\n"), SekGetPC(-1), byteValue);
384         m_has_ymrom_bus = false;
455385         break;
456386      case 0x0126:
457387//          bprintf(PRINT_NORMAL, _T("  - NGCD Z80 BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1));
r19378r19379
460390         break;
461391      case 0x0128:
462392//          bprintf(PRINT_NORMAL, _T("  - NGCD FIX BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1));
393         m_has_text_bus = false;
463394         break;
464
465395      case 0x0140:
466396//          bprintf(PRINT_NORMAL, _T("  - NGCD OBJ BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1));
397         m_has_sprite_bus = true;
467398         video_reset();
468399         break;
469400      case 0x0142:
470401//          bprintf(PRINT_NORMAL, _T("  - NGCD PCM BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1));
402         m_has_ymrom_bus = true;
471403         break;
472404      case 0x0146:
473405//          bprintf(PRINT_NORMAL, _T("  - NGCD Z80 BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1));
r19378r19379
476408         break;
477409      case 0x0148:
478410//          bprintf(PRINT_NORMAL, _T("  - NGCD FIX BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1));
411         m_has_text_bus = true;
479412         video_reset();
480413         break;
481414
r19378r19379
524457      }
525458      case 0x0182: {
526459      //   printf("blah %02x\n", byteValue);
527         if (byteValue == 0x00) m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
460         if (byteValue == 0x00)
461         {
462            machine().device("ymsnd")->reset();
463            m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
464         }
528465         else m_audiocpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
529466
530467         break;
r19378r19379
553490 */
554491
555492
556READ16_MEMBER(ng_aes_state::neocd_transfer_r)
493READ8_MEMBER(ng_aes_state::neocd_transfer_r)
557494{
558   int is_byte_transfer = 0;
559   if (mem_mask != 0xffff) is_byte_transfer = 1;
495   UINT32 sekAddress = 0xe00000+ (offset);
496   int address;
497   sekAddress ^= 1;
560498
561   UINT16 ret = 0x0000;
499   switch (nActiveTransferArea) {
500      case 0:   // Sprites
501         address = (nSpriteTransferBank + (sekAddress & 0x0FFFFF));
562502
503         // address is swizzled a bit due to out sprite decoding
504         if ((address&3)==0) return NeoSpriteRAM[address];
505         if ((address&3)==1) return NeoSpriteRAM[address^3];
506         if ((address&3)==2) return NeoSpriteRAM[address^3];
507         if ((address&3)==3) return NeoSpriteRAM[address];
563508
564
565   if (mem_mask & 0x00ff)
566   {
567      ret |= neogeoReadTransfer(0xe00000+ (offset*2)+1, is_byte_transfer) & 0xff;
509         return NeoSpriteRAM[nSpriteTransferBank + (sekAddress & 0x0FFFFF)];
510      case 1:                     // ADPCM
511         return YM2610ADPCMAROM[nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)];
512      case 4:                     // Z80
513         if ((sekAddress & 0xfffff) >= 0x20000) return ~0;
514         return NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1];
515      case 5:                     // Text
516         return NeoTextRAM[(sekAddress & 0x3FFFF) >> 1];
568517   }
569   if (mem_mask & 0xff00)
570   {
571      ret |= neogeoReadTransfer(0xe00000+ (offset*2), is_byte_transfer) << 8;
572   }
573518
574   return ret;
519   return ~0;
575520
576521}
577522
578WRITE16_MEMBER(ng_aes_state::neocd_transfer_w)
523WRITE8_MEMBER(ng_aes_state::neocd_transfer_w)
579524{
580   int is_byte_transfer = 0;
581   if (mem_mask != 0xffff) is_byte_transfer = 1;
525   UINT8 byteValue = data;
526   UINT32 sekAddress = 0xe00000+ (offset);
582527
583
584   if (mem_mask & 0xff00)
585   {
586      neogeoWriteTransfer(0xe00000+ (offset*2), data>>8, is_byte_transfer);
528   if (!nTransferWriteEnable) {
529//      return;
587530   }
531   int address;
588532
589   if (mem_mask & 0x00ff)
590   {
591      neogeoWriteTransfer(0xe00000+ (offset*2)+1, data&0xff, is_byte_transfer);
592   }
533   sekAddress ^= 1;
593534
535   switch (nActiveTransferArea) {
536      case 0:                     // Sprites
537         address = (nSpriteTransferBank + (sekAddress & 0x0FFFFF));
594538
539         // address is swizzled a bit due to out sprite decoding
540         if ((address&3)==0) NeoSpriteRAM[address] = byteValue;
541         if ((address&3)==1) NeoSpriteRAM[address^3] = byteValue;
542         if ((address&3)==2) NeoSpriteRAM[address^3] = byteValue;
543         if ((address&3)==3) NeoSpriteRAM[address] = byteValue;
544
545         break;
546      case 1:                     // ADPCM
547         YM2610ADPCMAROM[nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = byteValue;
548         break;
549      case 4:                     // Z80
550         if ((sekAddress & 0xfffff) >= 0x20000) break;
551
552         NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1] = byteValue;
553         break;
554      case 5:                     // Text
555         NeoTextRAM[(sekAddress & 0x3FFFF) >> 1] = byteValue;
556         break;
557   }
595558}
596559
597560
r19378r19379
12361199   AM_RANGE(0x800000, 0x803fff) AM_READWRITE(neocd_memcard_r, neocd_memcard_w)
12371200   AM_RANGE(0xc00000, 0xcfffff) AM_ROMBANK(NEOGEO_BANK_BIOS)
12381201   AM_RANGE(0xd00000, 0xd0ffff) AM_MIRROR(0x0f0000) AM_READ(neogeo_unmapped_r) AM_SHARE("save_ram") //AM_RAM_WRITE(save_ram_w)
1239   AM_RANGE(0xe00000, 0xefffff) AM_READWRITE(neocd_transfer_r,neocd_transfer_w)
1202   AM_RANGE(0xe00000, 0xefffff) AM_READWRITE8(neocd_transfer_r,neocd_transfer_w, 0xffff)
12401203   AM_RANGE(0xf00000, 0xfeffff) AM_READ(neogeo_unmapped_r)
12411204   AM_RANGE(0xff0000, 0xff01ff) AM_READWRITE(neocd_control_r, neocd_control_w) // CDROM / DMA
12421205   AM_RANGE(0xff0200, 0xffffff) AM_READ(neogeo_unmapped_r)
r19378r19379
16341597   ROM_SYSTEM_BIOS( 1, "front",   "Front loading NeoGeo CD" )
16351598   ROMX_LOAD( "front-sp1.bin",    0x00000, 0x80000, CRC(cac62307) SHA1(53bc1f283cdf00fa2efbb79f2e36d4c8038d743a), ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(2))
16361599
1637   ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASEFF )
1600   ROM_REGION( 0x100000, "ymsnd", ROMREGION_ERASEFF )
1601   /* 1MB of Sound RAM */
16381602
1639   ROM_REGION( 0x100000, "audiobios", ROMREGION_ERASEFF )
1640
16411603   ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF )
1604   /* 64KB of Z80 RAM */
16421605
1643   ROM_REGION( 0x20000, "zoomy", 0 )
1644   ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) )
1606   ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASE00 )
1607   /* 2MB of 68K RAM */
16451608
1646   ROM_REGION( 0x20000, "fixedbios", ROMREGION_ERASEFF )
1609   ROM_REGION( 0x400000, "sprites", ROMREGION_ERASEFF )
1610   /* 4MB of Sprite Tile RAM */
16471611
16481612   ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF )
1613   /* 128KB of Text Tile RAM */
16491614
1650   ROM_REGION( 0x400000, "ymsnd", ROMREGION_ERASEFF )
16511615
1652//    NO_DELTAT_REGION
16531616
1654   ROM_REGION( 0x400000, "sprites", ROMREGION_ERASEFF )
1617   ROM_REGION( 0x20000, "audiobios", ROMREGION_ERASEFF )
1618   ROM_REGION( 0x20000, "fixedbios", ROMREGION_ERASEFF )
1619   ROM_REGION( 0x20000, "zoomy", 0 )
1620   ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) )
16551621ROM_END
16561622
16571623ROM_START( neocdz )
16581624   ROM_REGION16_BE( 0x100000, "mainbios", 0 )
16591625   ROM_LOAD16_WORD_SWAP( "neocd.bin",    0x00000, 0x80000, CRC(df9de490) SHA1(7bb26d1e5d1e930515219cb18bcde5b7b23e2eda) )
16601626
1661   ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASEFF )
1627   ROM_REGION( 0x100000, "ymsnd", ROMREGION_ERASEFF )
1628   /* 1MB of Sound RAM */
16621629
1663   ROM_REGION( 0x20000, "audiobios", ROMREGION_ERASEFF )
1664
16651630   ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF )
1631   /* 64KB of Z80 RAM */
16661632
1667   ROM_REGION( 0x20000, "zoomy", 0 )
1668   ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) )
1633   ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASE00 )
1634   /* 2MB of 68K RAM */
16691635
1670   ROM_REGION( 0x20000, "fixedbios", ROMREGION_ERASEFF )
1636   ROM_REGION( 0x400000, "sprites", ROMREGION_ERASEFF )
1637   /* 4MB of Sprite Tile RAM */
16711638
16721639   ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF )
1640   /* 128KB of Text Tile RAM */
16731641
1674   ROM_REGION( 0x400000, "ymsnd", ROMREGION_ERASEFF )
16751642
1676//    NO_DELTAT_REGION
16771643
1678   ROM_REGION( 0x400000, "sprites", ROMREGION_ERASEFF )
1644
1645   ROM_REGION( 0x20000, "audiobios", ROMREGION_ERASEFF )
1646   ROM_REGION( 0x20000, "fixedbios", ROMREGION_ERASEFF )
1647
1648   ROM_REGION( 0x20000, "zoomy", 0 )
1649   ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) )
16791650ROM_END
16801651
16811652/*    YEAR  NAME  PARENT COMPAT MACHINE INPUT  INIT     COMPANY      FULLNAME            FLAGS */
trunk/src/mame/includes/neogeo.h
r19378r19379
4242      m_has_audio_banking = true;
4343      m_is_mvs = true;
4444      m_is_cartsys = true;
45      m_has_sprite_bus = true;
46      m_has_text_bus = true;
47      m_has_ymrom_bus = true;
4548   }
4649
4750   /* memory pointers */
r19378r19379
231234   bool m_has_audio_banking; // does the system use Audio Banking (the NeoCD doesn't?)
232235   bool m_is_mvs; // is the system an MVS (watchdog, SRAM etc.)
233236   bool m_is_cartsys; // does the system use Cartridges? (MVS and AES)
237   
238   // the NeoCD can steal the bus during uploads
239   bool m_has_sprite_bus;
240   bool m_has_text_bus;
241   bool m_has_ymrom_bus;
234242};
235243
236244
trunk/src/mame/video/neogeo.c
r19378r19379
921921   /* fill with background color first */
922922   bitmap.fill(m_pens[0x0fff], cliprect);
923923
924   draw_sprites(machine(), bitmap, cliprect.min_y);
924   if (m_has_sprite_bus) draw_sprites(machine(), bitmap, cliprect.min_y);
925925
926   draw_fixed_layer(machine(), bitmap, cliprect.min_y);
926   if (m_has_text_bus) draw_fixed_layer(machine(), bitmap, cliprect.min_y);
927927
928928   return 0;
929929}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team