trunk/hash/neocd.xml
| r18998 | r18999 | |
| 15 | 15 | </diskarea> |
| 16 | 16 | </part> |
| 17 | 17 | </software> |
| 18 | | |
| 18 | |
| 19 | <software name="lbowling"> |
| 20 | <description>League Bowling (1994)(SNK)(JP-US)[!]</description> |
| 21 | <year>199?</year> |
| 22 | <publisher>SNK</publisher> |
| 23 | <part name="cdrom" interface="neocd_cdrom"> |
| 24 | <diskarea name="cdrom"> |
| 25 | <disk name="league bowling (1994)(snk)(jp-us)[!]" sha1="ca657fa76e16ae70745a6938770677c523daa041"/> |
| 26 | </diskarea> |
| 27 | </part> |
| 28 | </software> |
| 29 | |
| 30 | <software name="crsword2"> |
| 31 | <description>Crossed Swords II (1995)(ADK)(JP)[!]</description> |
| 32 | <year>199?</year> |
| 33 | <publisher>SNK</publisher> |
| 34 | <part name="cdrom" interface="neocd_cdrom"> |
| 35 | <diskarea name="cdrom"> |
| 36 | <disk name="crossed swords ii (1995)(adk)(jp)[!]" sha1="dc65e9a937bfc912c3fdaff0b8200bfd4df4c34c"/> |
| 37 | </diskarea> |
| 38 | </part> |
| 39 | </software> |
| 40 | |
| 41 | <software name="zintrick"> |
| 42 | <description>Oshidashi Zintrick (1996)(ADK)(JP)[!][Zintrick]</description> |
| 43 | <year>199?</year> |
| 44 | <publisher>SNK</publisher> |
| 45 | <part name="cdrom" interface="neocd_cdrom"> |
| 46 | <diskarea name="cdrom"> |
| 47 | <disk name="oshidashi zintrick (1996)(adk)(jp)[!][zintrick]" sha1="46ab081316ffc6d5cca76fee679e80270fe1a8ab"/> |
| 48 | </diskarea> |
| 49 | </part> |
| 50 | </software> |
| 51 | |
| 52 | <software name="fromanc2"> |
| 53 | <description>Idol Mahjong Final Romance 2 (1995)(Video System)(JP)[!]</description> |
| 54 | <year>199?</year> |
| 55 | <publisher>SNK</publisher> |
| 56 | <part name="cdrom" interface="neocd_cdrom"> |
| 57 | <diskarea name="cdrom"> |
| 58 | <disk name="idol mahjong final romance 2 (1995)(video system)(jp)[!]" sha1="63c2b6c8cccfbcba9c41efb61954db9885ff9869"/> |
| 59 | </diskarea> |
| 60 | </part> |
| 61 | </software> |
| 62 | |
| 63 | <software name="lasthope"> |
| 64 | <description>Last Hope (DE) [NGDT CD-300J] [N.A.]</description> |
| 65 | <year>199?</year> |
| 66 | <publisher>SNK</publisher> |
| 67 | <part name="cdrom" interface="neocd_cdrom"> |
| 68 | <diskarea name="cdrom"> |
| 69 | <disk name="cd-rom [ngdt cd-300j] [v2007-10-03] [!-]" sha1="4cf60613098531b49c447a2b223aeb49a6395fd2"/> |
| 70 | </diskarea> |
| 71 | </part> |
| 72 | </software> |
| 73 | |
| 74 | <software name="ironclad"> |
| 75 | <description>Choutetsu Brikin'ger (1996)(Saurus)(JP)[!][Ironclad]</description> |
| 76 | <year>199?</year> |
| 77 | <publisher>SNK</publisher> |
| 78 | <part name="cdrom" interface="neocd_cdrom"> |
| 79 | <diskarea name="cdrom"> |
| 80 | <disk name="choutetsu brikin'ger (1996)(saurus)(jp)[!][ironclad]" sha1="4d518370686853c727eb300a91c0f070c3333225"/> |
| 81 | </diskarea> |
| 82 | </part> |
| 83 | </software> |
| 84 | |
| 85 | <software name="ncdspec"> |
| 86 | <description>Neo Geo CD Special (1996)(SNK)(JP)[!]</description> |
| 87 | <year>199?</year> |
| 88 | <publisher>SNK</publisher> |
| 89 | <part name="cdrom" interface="neocd_cdrom"> |
| 90 | <diskarea name="cdrom"> |
| 91 | <disk name="neo geo cd special (1996)(snk)(jp)[!]" sha1="20ceb3e2cb21c6ccad99e0e21dc990affb4ecc39"/> |
| 92 | </diskarea> |
| 93 | </part> |
| 94 | </software> |
| 95 | |
| 96 | |
| 97 | <software name="kof96col"> |
| 98 | <description>King of Fighters '96 NEOGEO Collection, The (1997)(SNK)(JP)[!][NGCD-229 MT B07]</description> |
| 99 | <year>199?</year> |
| 100 | <publisher>SNK</publisher> |
| 101 | <part name="cdrom" interface="neocd_cdrom"> |
| 102 | <diskarea name="cdrom"> |
| 103 | <disk name="king of fighters '96 neogeo collection, the (1997)(snk)(jp)[!][ngcd-229 mt b07]" sha1="4f0fa12fc1e6b77e08fbbfa84366dbb04ca09f32"/> |
| 104 | </diskarea> |
| 105 | </part> |
| 106 | </software> |
| 107 | |
| 108 | <software name="trally"> |
| 109 | <description>Rally Chase (1994)(ADK)(JP)[!]</description> |
| 110 | <year>199?</year> |
| 111 | <publisher>SNK</publisher> |
| 112 | <part name="cdrom" interface="neocd_cdrom"> |
| 113 | <diskarea name="cdrom"> |
| 114 | <disk name="rally chase (1994)(adk)(jp)[!]" sha1="07a394aaf9937206f4bd61e2c9f46afe1a43aecb"/> |
| 115 | </diskarea> |
| 116 | </part> |
| 117 | </software> |
| 118 | |
| 119 | <software name="adkworld"> |
| 120 | <description>ADK World (1995)(ADK)(JP)[!]</description> |
| 121 | <year>199?</year> |
| 122 | <publisher>SNK</publisher> |
| 123 | <part name="cdrom" interface="neocd_cdrom"> |
| 124 | <diskarea name="cdrom"> |
| 125 | <disk name="adk world (1995)(adk)(jp)[!]" sha1="c99032d62ce5bf6be9b1dc37c70ef45a4dc37180"/> |
| 126 | </diskarea> |
| 127 | </part> |
| 128 | </software> |
| 129 | |
| 130 | <software name="samsrpg"> |
| 131 | <description>Shinsetsu Samurai Spirits - Bushidohretsuden (1997)(SNK)(JP)[!][NGCD-0850 MT A01]</description> |
| 132 | <year>199?</year> |
| 133 | <publisher>SNK</publisher> |
| 134 | <part name="cdrom" interface="neocd_cdrom"> |
| 135 | <diskarea name="cdrom"> |
| 136 | <disk name="shinsetsu samurai spirits - bushidohretsuden (1997)(snk)(jp)[!][ngcd-0850 mt a01]" sha1="5df33f9533c2bc55c3354790bcafb1350039b438"/> |
| 137 | </diskarea> |
| 138 | </part> |
| 139 | </software> |
| 140 | |
| 19 | 141 | <!-- disable most things for now, until I actually get it working --> |
| 20 | 142 | <!-- |
| 21 | 143 | <software name="2020bb"> |
| r18998 | r18999 | |
| 40 | 162 | </part> |
| 41 | 163 | </software> |
| 42 | 164 | |
| 43 | | <software name="adkworld"> |
| 44 | | <description>ADK World (1995)(ADK)(JP)[!]</description> |
| 45 | | <year>199?</year> |
| 46 | | <publisher>SNK</publisher> |
| 47 | | <part name="cdrom" interface="neocd_cdrom"> |
| 48 | | <diskarea name="cdrom"> |
| 49 | | <disk name="adk world (1995)(adk)(jp)[!]" sha1="c99032d62ce5bf6be9b1dc37c70ef45a4dc37180"/> |
| 50 | | </diskarea> |
| 51 | | </part> |
| 52 | | </software> |
| 53 | | |
| 54 | 165 | <software name="sonicwi2"> |
| 55 | 166 | <description>Aero Fighters 2 (1994)(SNK)(JP-US)[!][Sonic Wings 2]</description> |
| 56 | 167 | <year>199?</year> |
| r18998 | r18999 | |
| 200 | 311 | <publisher>SNK</publisher> |
| 201 | 312 | <part name="cdrom" interface="neocd_cdrom"> |
| 202 | 313 | <diskarea name="cdrom"> |
| 203 | | <disk name="cd-rom [ngcd-500] [v2011-12-22] [!-].chd" sha1="95c9e0b42410ac4e384529b3c067cb55e9b0e537"/> |
| 314 | <disk name="cd-rom [ngcd-500] [v2011-12-22] [!-]" sha1="95c9e0b42410ac4e384529b3c067cb55e9b0e537"/> |
| 204 | 315 | </diskarea> |
| 205 | 316 | </part> |
| 206 | 317 | </software> |
| 207 | 318 | |
| 208 | | <software name="lasthope"> |
| 209 | | <description>Last Hope (DE) [NGDT CD-300J] [N.A.]</description> |
| 210 | | <year>199?</year> |
| 211 | | <publisher>SNK</publisher> |
| 212 | | <part name="cdrom" interface="neocd_cdrom"> |
| 213 | | <diskarea name="cdrom"> |
| 214 | | <disk name="cd-rom [ngdt cd-300j] [v2007-10-03] [!-].chd" sha1="4cf60613098531b49c447a2b223aeb49a6395fd2"/> |
| 215 | | </diskarea> |
| 216 | | </part> |
| 217 | | </software> |
| 218 | 319 | |
| 219 | | <software name="ironclad"> |
| 220 | | <description>Choutetsu Brikin'ger (1996)(Saurus)(JP)[!][Ironclad]</description> |
| 221 | | <year>199?</year> |
| 222 | | <publisher>SNK</publisher> |
| 223 | | <part name="cdrom" interface="neocd_cdrom"> |
| 224 | | <diskarea name="cdrom"> |
| 225 | | <disk name="choutetsu brikin'ger (1996)(saurus)(jp)[!][ironclad]" sha1="4d518370686853c727eb300a91c0f070c3333225"/> |
| 226 | | </diskarea> |
| 227 | | </part> |
| 228 | | </software> |
| 229 | 320 | |
| 230 | 321 | <software name="crsword"> |
| 231 | 322 | <description>Crossed Swords (1994)(ADK)(JP)[!]</description> |
| r18998 | r18999 | |
| 238 | 329 | </part> |
| 239 | 330 | </software> |
| 240 | 331 | |
| 241 | | <software name="crsword2"> |
| 242 | | <description>Crossed Swords II (1995)(ADK)(JP)[!]</description> |
| 243 | | <year>199?</year> |
| 244 | | <publisher>SNK</publisher> |
| 245 | | <part name="cdrom" interface="neocd_cdrom"> |
| 246 | | <diskarea name="cdrom"> |
| 247 | | <disk name="crossed swords ii (1995)(adk)(jp)[!]" sha1="dc65e9a937bfc912c3fdaff0b8200bfd4df4c34c"/> |
| 248 | | </diskarea> |
| 249 | | </part> |
| 250 | | </software> |
| 251 | 332 | |
| 333 | |
| 252 | 334 | <software name="cyberlip"> |
| 253 | 335 | <description>Cyber-Lip (1995)(SNK)(JP-US)[!]</description> |
| 254 | 336 | <year>199?</year> |
| r18998 | r18999 | |
| 370 | 452 | </part> |
| 371 | 453 | </software> |
| 372 | 454 | |
| 373 | | <software name="fromanc2"> |
| 374 | | <description>Idol Mahjong Final Romance 2 (1995)(Video System)(JP)[!]</description> |
| 375 | | <year>199?</year> |
| 376 | | <publisher>SNK</publisher> |
| 377 | | <part name="cdrom" interface="neocd_cdrom"> |
| 378 | | <diskarea name="cdrom"> |
| 379 | | <disk name="idol mahjong final romance 2 (1995)(video system)(jp)[!]" sha1="63c2b6c8cccfbcba9c41efb61954db9885ff9869"/> |
| 380 | | </diskarea> |
| 381 | | </part> |
| 382 | | </software> |
| 383 | 455 | |
| 384 | 456 | <software name="janshin"> |
| 385 | 457 | <description>Janshin Densetsu - Quest of the Jongmaster (1995)(SNK)(JP)[!]</description> |
| r18998 | r18999 | |
| 447 | 519 | </part> |
| 448 | 520 | </software> |
| 449 | 521 | |
| 450 | | <software name="kof96col"> |
| 451 | | <description>King of Fighters '96 NEOGEO Collection, The (1997)(SNK)(JP)[!][NGCD-229 MT B07]</description> |
| 452 | | <year>199?</year> |
| 453 | | <publisher>SNK</publisher> |
| 454 | | <part name="cdrom" interface="neocd_cdrom"> |
| 455 | | <diskarea name="cdrom"> |
| 456 | | <disk name="king of fighters '96 neogeo collection, the (1997)(snk)(jp)[!][ngcd-229 mt b07]" sha1="4f0fa12fc1e6b77e08fbbfa84366dbb04ca09f32"/> |
| 457 | | </diskarea> |
| 458 | | </part> |
| 459 | | </software> |
| 460 | | |
| 461 | 522 | <software name="kof96"> |
| 462 | 523 | <description>King of Fighters '96, The (1996)(SNK)(JP)[!][NGCD-214 MT A02+A03]</description> |
| 463 | 524 | <year>199?</year> |
| r18998 | r18999 | |
| 546 | 607 | </part> |
| 547 | 608 | </software> |
| 548 | 609 | |
| 549 | | <software name="lbowling"> |
| 550 | | <description>League Bowling (1994)(SNK)(JP-US)[!]</description> |
| 551 | | <year>199?</year> |
| 552 | | <publisher>SNK</publisher> |
| 553 | | <part name="cdrom" interface="neocd_cdrom"> |
| 554 | | <diskarea name="cdrom"> |
| 555 | | <disk name="league bowling (1994)(snk)(jp-us)[!]" sha1="ca657fa76e16ae70745a6938770677c523daa041"/> |
| 556 | | </diskarea> |
| 557 | | </part> |
| 558 | | </software> |
| 559 | | |
| 560 | 610 | <software name="magdrop2"> |
| 561 | 611 | <description>Magical Drop 2 (1996)(Data East)(JP)[!]</description> |
| 562 | 612 | <year>199?</year> |
| r18998 | r18999 | |
| 645 | 695 | </part> |
| 646 | 696 | </software> |
| 647 | 697 | |
| 648 | | <software name="ncdspec"> |
| 649 | | <description>Neo Geo CD Special (1996)(SNK)(JP)[!]</description> |
| 650 | | <year>199?</year> |
| 651 | | <publisher>SNK</publisher> |
| 652 | | <part name="cdrom" interface="neocd_cdrom"> |
| 653 | | <diskarea name="cdrom"> |
| 654 | | <disk name="neo geo cd special (1996)(snk)(jp)[!]" sha1="20ceb3e2cb21c6ccad99e0e21dc990affb4ecc39"/> |
| 655 | | </diskarea> |
| 656 | | </part> |
| 657 | | </software> |
| 658 | 698 | |
| 699 | |
| 659 | 700 | <software name="turfmast"> |
| 660 | 701 | <description>Neo Turf Masters (1996)(SNK)(JP)[!][Big Tournament Golf]</description> |
| 661 | 702 | <year>199?</year> |
| r18998 | r18999 | |
| 700 | 741 | </part> |
| 701 | 742 | </software> |
| 702 | 743 | |
| 703 | | <software name="zintrick"> |
| 704 | | <description>Oshidashi Zintrick (1996)(ADK)(JP)[!][Zintrick]</description> |
| 705 | | <year>199?</year> |
| 706 | | <publisher>SNK</publisher> |
| 707 | | <part name="cdrom" interface="neocd_cdrom"> |
| 708 | | <diskarea name="cdrom"> |
| 709 | | <disk name="oshidashi zintrick (1996)(adk)(jp)[!][zintrick]" sha1="46ab081316ffc6d5cca76fee679e80270fe1a8ab"/> |
| 710 | | </diskarea> |
| 711 | | </part> |
| 712 | | </software> |
| 713 | 744 | |
| 714 | 745 | <software name="overtop"> |
| 715 | 746 | <description>OverTop (1996)(ADK)(JP)[!]</description> |
| r18998 | r18999 | |
| 777 | 808 | </part> |
| 778 | 809 | </software> |
| 779 | 810 | |
| 780 | | <software name="trally"> |
| 781 | | <description>Rally Chase (1994)(ADK)(JP)[!]</description> |
| 782 | | <year>199?</year> |
| 783 | | <publisher>SNK</publisher> |
| 784 | | <part name="cdrom" interface="neocd_cdrom"> |
| 785 | | <diskarea name="cdrom"> |
| 786 | | <disk name="rally chase (1994)(adk)(jp)[!]" sha1="07a394aaf9937206f4bd61e2c9f46afe1a43aecb"/> |
| 787 | | </diskarea> |
| 788 | | </part> |
| 789 | | </software> |
| 790 | | |
| 791 | 811 | <software name="rbff1"> |
| 792 | 812 | <description>Real Bout Fatal Fury (1996)(SNK)(JP-US)[!][Real Bout Garou Densetsu][NGCD-095 MT B06+B08, NGCD-095E]</description> |
| 793 | 813 | <year>199?</year> |
| r18998 | r18999 | |
| 931 | 951 | </part> |
| 932 | 952 | </software> |
| 933 | 953 | |
| 934 | | <software name="samsrpg"> |
| 935 | | <description>Shinsetsu Samurai Spirits - Bushidohretsuden (1997)(SNK)(JP)[!][NGCD-0850 MT A01]</description> |
| 936 | | <year>199?</year> |
| 937 | | <publisher>SNK</publisher> |
| 938 | | <part name="cdrom" interface="neocd_cdrom"> |
| 939 | | <diskarea name="cdrom"> |
| 940 | | <disk name="shinsetsu samurai spirits - bushidohretsuden (1997)(snk)(jp)[!][ngcd-0850 mt a01]" sha1="5df33f9533c2bc55c3354790bcafb1350039b438"/> |
| 941 | | </diskarea> |
| 942 | | </part> |
| 943 | | </software> |
| 944 | | |
| 945 | 954 | <software name="mosyougi"> |
| 946 | 955 | <description>Shougi no Tatsujin - Master of Syougi (1995)(ADK)(JP)[!]</description> |
| 947 | 956 | <year>199?</year> |
trunk/src/mess/drivers/ng_aes.c
| r18998 | r18999 | |
| 38 | 38 | #include "imagedev/chd_cd.h" |
| 39 | 39 | #include "sound/cdda.h" |
| 40 | 40 | |
| 41 | struct neocd_t |
| 42 | { |
| 43 | cdrom_file *cd; |
| 44 | const cdrom_toc *toc; |
| 45 | UINT32 current_frame; |
| 46 | }; |
| 47 | |
| 48 | static neocd_t neocd; |
| 49 | |
| 41 | 50 | extern const char layout_neogeo[]; |
| 42 | 51 | |
| 43 | 52 | static const char *audio_banks[4] = |
| r18998 | r18999 | |
| 67 | 76 | #define SEK_IRQSTATUS_AUTO (0x2000) |
| 68 | 77 | #define SEK_IRQSTATUS_ACK (0x1000) |
| 69 | 78 | |
| 70 | | static INT32 nNeoCDIRQVector = 0; |
| 71 | | static INT32 nNeoCDIRQVectorAck = 0; |
| 79 | static IRQ_CALLBACK(neocd_int_callback); |
| 72 | 80 | |
| 73 | 81 | /* Stubs for various functions called by the FBA code, replace with MAME specifics later */ |
| 74 | 82 | #define MAX_SLOT (8) |
| 75 | 83 | UINT8 *NeoSpriteRAM, *NeoTextRAM; |
| 76 | | UINT8* NeoSpriteROM[MAX_SLOT]; |
| 77 | | UINT8* NeoTextROM[MAX_SLOT]; |
| 84 | //UINT8* NeoSpriteROM[MAX_SLOT]; |
| 85 | //UINT8* NeoTextROM[MAX_SLOT]; |
| 78 | 86 | UINT8* YM2610ADPCMAROM[MAX_SLOT]; |
| 79 | 87 | UINT8* NeoZ80ROMActive; |
| 80 | 88 | UINT32 nNeoActiveSlot; |
| 81 | | UINT8 NeoSystem; |
| 89 | UINT8 NeoSystem = 6; |
| 82 | 90 | INT32 nNeoCDZ80ProgWriteWordCancelHack = 0; |
| 83 | 91 | |
| 84 | 92 | enum CDEmuStatusValue { idle = 0, reading, playing, paused, seeking, fastforward, fastreverse }; |
| r18998 | r18999 | |
| 86 | 94 | |
| 87 | 95 | static inline CDEmuStatusValue CDEmuGetStatus() |
| 88 | 96 | { |
| 97 | printf("CDEmuGetStatus\n"); |
| 89 | 98 | return CDEmuStatus; |
| 90 | 99 | } |
| 91 | 100 | |
| 92 | | static UINT8* CDEmuReadQChannel() |
| 101 | static UINT8* CDEmuReadQChannel(int NeoCDSectorLBA) |
| 93 | 102 | { |
| 94 | | return NULL; |
| 103 | printf("CDEmuReadQChannel\n"); |
| 104 | static unsigned char QChannelData[8]; |
| 105 | |
| 106 | if(neocd.cd == NULL) // no cd is there, bail out |
| 107 | return QChannelData; |
| 108 | |
| 109 | // NeoCDSectorLBA |
| 110 | switch (CDEmuStatus) { |
| 111 | case reading: |
| 112 | case playing: { |
| 113 | |
| 114 | UINT32 msf; |
| 115 | msf = lba_to_msf_alt(NeoCDSectorLBA+150); |
| 116 | |
| 117 | |
| 118 | |
| 119 | QChannelData[0] = cdrom_get_track(neocd.cd, NeoCDSectorLBA); |
| 120 | |
| 121 | QChannelData[1] = (msf >> 16)&0xff; |
| 122 | QChannelData[2] = (msf >> 8)&0xff; |
| 123 | QChannelData[3] = (msf >> 0)&0xff; |
| 124 | |
| 125 | int elapsedlba; |
| 126 | elapsedlba = NeoCDSectorLBA - neocd.toc->tracks[ cdrom_get_track(neocd.cd, NeoCDSectorLBA) ].physframeofs; |
| 127 | msf = lba_to_msf_alt (elapsedlba); |
| 128 | |
| 129 | QChannelData[4] = (msf >> 16)&0xff; |
| 130 | QChannelData[5] = (msf >> 8)&0xff; |
| 131 | QChannelData[6] = (msf >> 0)&0xff; |
| 132 | |
| 133 | if (QChannelData[0]==1) |
| 134 | QChannelData[7] = 0x4; |
| 135 | else |
| 136 | QChannelData[7] = 0x0; |
| 137 | |
| 138 | break; |
| 139 | } |
| 140 | case paused: { |
| 141 | break; |
| 142 | } |
| 143 | default: { |
| 144 | memset(QChannelData, 0, sizeof(QChannelData)); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | return QChannelData; |
| 95 | 149 | } |
| 96 | 150 | |
| 97 | 151 | static UINT8* CDEmuReadTOC(INT32 track) |
| 98 | 152 | { |
| 99 | | return NULL; |
| 153 | printf("CDEmuReadTOC\n"); |
| 154 | |
| 155 | static unsigned char TOCEntry[4]; |
| 156 | |
| 157 | if(neocd.cd == NULL) |
| 158 | return TOCEntry; |
| 159 | |
| 160 | |
| 161 | if (track == -1) { |
| 162 | printf("get first/last track nums\n"); |
| 163 | TOCEntry[0] = 1; |
| 164 | TOCEntry[1] = cdrom_get_last_track(neocd.cd); |
| 165 | TOCEntry[2] = 0; |
| 166 | TOCEntry[3] = 0; |
| 167 | |
| 168 | return TOCEntry; |
| 169 | } |
| 170 | else if (track == -2) { |
| 171 | printf("get disc length\n"); |
| 172 | |
| 173 | UINT32 startlba = (neocd.toc->tracks[cdrom_get_last_track(neocd.cd)].physframeofs); |
| 174 | UINT32 startmsf = lba_to_msf_alt( startlba ); |
| 175 | |
| 176 | |
| 177 | TOCEntry[0] = (startmsf >> 16)&0xff; |
| 178 | TOCEntry[1] = (startmsf >> 8)&0xff; |
| 179 | TOCEntry[2] = (startmsf >> 0)&0xff; |
| 180 | |
| 181 | TOCEntry[3] = 0; |
| 182 | |
| 183 | return TOCEntry; |
| 184 | } |
| 185 | else |
| 186 | { |
| 187 | printf("get track address\n"); |
| 188 | |
| 189 | int last_track = cdrom_get_last_track(neocd.cd); |
| 190 | |
| 191 | if (track > last_track) |
| 192 | track = last_track; |
| 193 | |
| 194 | if (track < 1) |
| 195 | track = 1; |
| 196 | |
| 197 | UINT32 startlba = (neocd.toc->tracks[track-1].physframeofs); |
| 198 | UINT32 startmsf = lba_to_msf_alt( startlba+150 ); |
| 199 | |
| 200 | TOCEntry[0] = (startmsf >> 16)&0xff; |
| 201 | TOCEntry[1] = (startmsf >> 8)&0xff; |
| 202 | TOCEntry[2] = (startmsf >> 0)&0xff; |
| 203 | TOCEntry[3] = track % 10;; |
| 204 | } |
| 205 | |
| 206 | return TOCEntry; |
| 207 | |
| 100 | 208 | } |
| 101 | 209 | |
| 102 | 210 | static void CDEmuStartRead() |
| 103 | 211 | { |
| 212 | printf("CDEmuStartRead\n"); |
| 104 | 213 | CDEmuStatus = seeking; |
| 105 | 214 | } |
| 106 | 215 | |
| 107 | 216 | static void CDEmuPause() |
| 108 | 217 | { |
| 218 | printf("CDEmuPause\n"); |
| 109 | 219 | CDEmuStatus = paused; |
| 110 | 220 | } |
| 111 | 221 | |
| 112 | 222 | static INT32 CDEmuStop() |
| 113 | 223 | { |
| 224 | printf("CDEmuStop\n"); |
| 114 | 225 | return 1; |
| 115 | 226 | } |
| 116 | 227 | |
| 117 | 228 | static INT32 CDEmuPlay(UINT8 M, UINT8 S, UINT8 F) |
| 118 | 229 | { |
| 230 | printf("CDEmuPlay\n"); |
| 119 | 231 | return 1; |
| 120 | 232 | } |
| 121 | 233 | |
| 122 | 234 | static INT32 CDEmuLoadSector(INT32 LBA, char* pBuffer) |
| 123 | 235 | { |
| 124 | | return 0; |
| 125 | | } |
| 236 | printf("CDEmuLoadSector %d\n", LBA); |
| 237 | //LBA += 150; |
| 126 | 238 | |
| 127 | | static void SekWriteWord(UINT32 a, UINT16 d) |
| 128 | | { |
| 239 | cdrom_read_data(neocd.cd, LBA, pBuffer, CD_TRACK_MODE1); |
| 129 | 240 | |
| 241 | return LBA+1;// - 150; |
| 130 | 242 | } |
| 131 | 243 | |
| 132 | | static void SekWriteByte(UINT32 a, UINT8 d) |
| 133 | | { |
| 134 | 244 | |
| 135 | | } |
| 136 | 245 | |
| 137 | | static UINT32 SekReadByte(UINT32 a) |
| 138 | | { |
| 139 | | return 0; |
| 140 | | } |
| 141 | | |
| 142 | | |
| 143 | | static UINT32 SekReadWord(UINT32 a) |
| 144 | | { |
| 145 | | return 0; |
| 146 | | } |
| 147 | | |
| 148 | | |
| 149 | 246 | static INT32 SekIdle(INT32 nCycles) |
| 150 | 247 | { |
| 151 | 248 | return nCycles; |
| r18998 | r18999 | |
| 173 | 270 | } |
| 174 | 271 | |
| 175 | 272 | |
| 176 | | static void NeoDecodeSpritesCD(UINT8* pData, UINT8* pDest, INT32 nSize) |
| 177 | | { |
| 178 | 273 | |
| 179 | | } |
| 180 | 274 | |
| 181 | | static void NeoUpdateSprites(INT32 nOffset, INT32 nSize) |
| 182 | | { |
| 183 | | |
| 184 | | } |
| 185 | | |
| 186 | | static void NeoUpdateText(INT32 nOffset, const INT32 nSize, UINT8* pData, UINT8* pDest) |
| 187 | | { |
| 188 | | |
| 189 | | } |
| 190 | | |
| 191 | 275 | static void MapVectorTable(bool bMapBoardROM) |
| 192 | 276 | { |
| 193 | 277 | /* |
| r18998 | r18999 | |
| 212 | 296 | : neogeo_state(mconfig, type, tag) |
| 213 | 297 | { |
| 214 | 298 | nff0002 = 0; |
| 215 | | nIRQAcknowledge = 0; |
| 299 | nIRQAcknowledge = ~0; |
| 216 | 300 | for (int i=0;i<10;i++) |
| 217 | 301 | NeoCDCommsCommandFIFO[i] = 0; |
| 218 | 302 | for (int i=0;i<10;i++) |
| r18998 | r18999 | |
| 234 | 318 | NeoCDDMACount = 0; |
| 235 | 319 | NeoCDDMAMode = 0; |
| 236 | 320 | nLC8951Register = 0; |
| 321 | nNeoCDIRQVectorAck = 0; |
| 322 | nNeoCDIRQVector = 0; |
| 237 | 323 | } |
| 238 | 324 | |
| 239 | 325 | UINT8 *m_memcard_data; |
| r18998 | r18999 | |
| 264 | 350 | DECLARE_MACHINE_START(neocd); |
| 265 | 351 | DECLARE_MACHINE_START(neogeo); |
| 266 | 352 | DECLARE_MACHINE_RESET(neogeo); |
| 353 | |
| 267 | 354 | DECLARE_CUSTOM_INPUT_MEMBER(get_memcard_status); |
| 268 | 355 | |
| 269 | 356 | TIMER_CALLBACK_MEMBER(display_position_interrupt_callback); |
| r18998 | r18999 | |
| 342 | 429 | void neogeoWriteByteTransfer(UINT32 sekAddress, UINT8 byteValue); |
| 343 | 430 | void neogeoWriteWordTransfer(UINT32 sekAddress, UINT16 wordValue); |
| 344 | 431 | void NeoIRQUpdate(UINT16 wordValue); |
| 432 | void SekWriteWord(UINT32 a, UINT16 d); |
| 433 | void SekWriteByte(UINT32 a, UINT8 d); |
| 434 | UINT32 SekReadByte(UINT32 a); |
| 435 | UINT32 SekReadWord(UINT32 a); |
| 436 | address_space* curr_space; |
| 437 | int nNeoCDIRQVectorAck; |
| 438 | int nNeoCDIRQVector; |
| 345 | 439 | |
| 346 | 440 | }; |
| 347 | 441 | |
| 442 | void ng_aes_state::SekWriteWord(UINT32 a, UINT16 d) |
| 443 | { |
| 444 | // printf("write word %08x %04x\n", a, d); |
| 445 | curr_space->write_word(a,d); |
| 446 | } |
| 348 | 447 | |
| 448 | void ng_aes_state::SekWriteByte(UINT32 a, UINT8 d) |
| 449 | { |
| 450 | // printf("write byte %08x %02x\n", a, d); |
| 451 | curr_space->write_byte(a,d); |
| 452 | } |
| 349 | 453 | |
| 454 | UINT32 ng_aes_state::SekReadByte(UINT32 a) |
| 455 | { |
| 456 | // printf("read byte %08x\n", a); |
| 457 | return curr_space->read_byte(a); |
| 458 | } |
| 459 | |
| 460 | |
| 461 | UINT32 ng_aes_state::SekReadWord(UINT32 a) |
| 462 | { |
| 463 | // printf("read WORD %08x\n", a); |
| 464 | return curr_space->read_word(a); |
| 465 | } |
| 466 | |
| 467 | |
| 468 | |
| 350 | 469 | #define LOG_VIDEO_SYSTEM (0) |
| 351 | 470 | #define LOG_CPU_COMM (0) |
| 352 | 471 | #define LOG_MAIN_CPU_BANKING (1) |
| r18998 | r18999 | |
| 972 | 1091 | * |
| 973 | 1092 | */ |
| 974 | 1093 | |
| 975 | | static void neocd_do_dma(address_space& space) |
| 976 | | { |
| 977 | | ng_aes_state *state = space.machine().driver_data<ng_aes_state>(); |
| 978 | | // TODO: Proper DMA timing and control |
| 979 | | int count; |
| 980 | | // UINT16 word; |
| 981 | 1094 | |
| 982 | | switch(state->m_neocd_ctrl.dma_mode[0]) |
| 983 | | { |
| 984 | | case 0xffdd: |
| 985 | | for(count=0;count<state->m_neocd_ctrl.word_count;count++) |
| 986 | | { |
| 987 | | //word = space.read_word(state->m_neocd_ctrl.addr_source); |
| 988 | | space.write_word(state->m_neocd_ctrl.addr_source+(count*2),state->m_neocd_ctrl.fill_word); |
| 989 | | } |
| 990 | | logerror("CTRL: DMA word-fill transfer of %i bytes\n",count*2); |
| 991 | | break; |
| 992 | | case 0xfef5: |
| 993 | | for(count=0;count<state->m_neocd_ctrl.word_count;count++) |
| 994 | | { |
| 995 | | //word = space.read_word(state->m_neocd_ctrl.addr_source); |
| 996 | | space.write_word(state->m_neocd_ctrl.addr_source+(count*4),(state->m_neocd_ctrl.addr_source+(count*4)) >> 16); |
| 997 | | space.write_word(state->m_neocd_ctrl.addr_source+(count*4)+2,(state->m_neocd_ctrl.addr_source+(count*4)) & 0xffff); |
| 998 | | } |
| 999 | | logerror("CTRL: DMA mode 2 transfer of %i bytes\n",count*4); |
| 1000 | | break; |
| 1001 | | case 0xcffd: |
| 1002 | | for(count=0;count<state->m_neocd_ctrl.word_count;count++) |
| 1003 | | { |
| 1004 | | //word = space.read_word(state->m_neocd_ctrl.addr_source); |
| 1005 | | space.write_word(state->m_neocd_ctrl.addr_source+(count*8),((state->m_neocd_ctrl.addr_source+(count*8)) >> 24) | 0xff00); |
| 1006 | | space.write_word(state->m_neocd_ctrl.addr_source+(count*8)+2,((state->m_neocd_ctrl.addr_source+(count*8)) >> 16) | 0xff00); |
| 1007 | | space.write_word(state->m_neocd_ctrl.addr_source+(count*8)+4,((state->m_neocd_ctrl.addr_source+(count*8)) >> 8) | 0xff00); |
| 1008 | | space.write_word(state->m_neocd_ctrl.addr_source+(count*8)+6,(state->m_neocd_ctrl.addr_source+(count*8)) | 0xff00); |
| 1009 | | } |
| 1010 | | logerror("CTRL: DMA mode 3 transfer of %i bytes\n",count*8); |
| 1011 | | break; |
| 1012 | | default: |
| 1013 | | logerror("CTRL: Unknown DMA transfer mode %04x\n",state->m_neocd_ctrl.dma_mode[0]); |
| 1014 | | } |
| 1015 | | } |
| 1016 | | |
| 1017 | | READ16_MEMBER(ng_aes_state::neocd_control_r) |
| 1018 | | { |
| 1019 | | |
| 1020 | | switch(offset) |
| 1021 | | { |
| 1022 | | |
| 1023 | | case 0x16/2: |
| 1024 | | return nff0016; |
| 1025 | | |
| 1026 | | case 0x64/2: // source address, high word |
| 1027 | | return (m_neocd_ctrl.addr_source >> 16) & 0xffff; |
| 1028 | | case 0x66/2: // source address, low word |
| 1029 | | return m_neocd_ctrl.addr_source & 0xffff; |
| 1030 | | case 0x68/2: // target address, high word |
| 1031 | | return (m_neocd_ctrl.addr_target >> 16) & 0xffff; |
| 1032 | | case 0x6a/2: // target address, low word |
| 1033 | | return m_neocd_ctrl.addr_target & 0xffff; |
| 1034 | | case 0x6c/2: // fill word |
| 1035 | | return m_neocd_ctrl.fill_word; |
| 1036 | | case 0x70/2: // word count |
| 1037 | | return (m_neocd_ctrl.word_count >> 16) & 0xffff; |
| 1038 | | case 0x72/2: |
| 1039 | | return m_neocd_ctrl.word_count & 0xffff; |
| 1040 | | case 0x7e/2: // DMA parameters |
| 1041 | | case 0x80/2: |
| 1042 | | case 0x82/2: |
| 1043 | | case 0x84/2: |
| 1044 | | case 0x86/2: |
| 1045 | | case 0x88/2: |
| 1046 | | case 0x8a/2: |
| 1047 | | case 0x8c/2: |
| 1048 | | case 0x8e/2: |
| 1049 | | return m_neocd_ctrl.dma_mode[offset-(0x7e/2)]; |
| 1050 | | case 0x105/2: |
| 1051 | | return m_neocd_ctrl.area_sel; |
| 1052 | | case 0x11c/2: |
| 1053 | | logerror("CTRL: Read region code.\n"); |
| 1054 | | return 0x0600; // we'll just force USA region for now |
| 1055 | | case 0x1a0/2: |
| 1056 | | return m_neocd_ctrl.spr_bank_sel; |
| 1057 | | case 0x1a2/2: |
| 1058 | | return m_neocd_ctrl.pcm_bank_sel; |
| 1059 | | default: |
| 1060 | | logerror("CTRL: Read offset %04x\n",offset); |
| 1061 | | } |
| 1062 | | |
| 1063 | | return 0; |
| 1064 | | } |
| 1065 | | |
| 1066 | | |
| 1067 | 1095 | void ng_aes_state::NeoCDReadSector() |
| 1068 | 1096 | { |
| 1069 | 1097 | if ((nff0002 & 0x0500)) { |
| r18998 | r18999 | |
| 1071 | 1099 | |
| 1072 | 1100 | // if (LC8951RegistersW[10] & 0x80) { |
| 1073 | 1101 | NeoCDSectorLBA++; |
| 1074 | | NeoCDSectorLBA = CDEmuLoadSector(NeoCDSectorLBA, NeoCDSectorData + 4) - 1; |
| 1102 | NeoCDSectorLBA = CDEmuLoadSector(NeoCDSectorLBA, NeoCDSectorData + 4) -1; |
| 1075 | 1103 | // } |
| 1076 | 1104 | |
| 1077 | 1105 | if (LC8951RegistersW[10] & 0x80) { |
| r18998 | r18999 | |
| 1170 | 1198 | if (!nTransferWriteEnable) { |
| 1171 | 1199 | // return; |
| 1172 | 1200 | } |
| 1201 | int address; |
| 1173 | 1202 | |
| 1174 | 1203 | sekAddress ^= 1; |
| 1175 | 1204 | |
| 1176 | 1205 | switch (nActiveTransferArea) { |
| 1177 | 1206 | case 0: // Sprites |
| 1178 | | NeoSpriteRAM[nSpriteTransferBank + (sekAddress & 0x0FFFFF)] = byteValue; |
| 1179 | | NeoCDOBJBankUpdate[nSpriteTransferBank >> 20] = true; |
| 1207 | address = (nSpriteTransferBank + (sekAddress & 0x0FFFFF)); |
| 1208 | |
| 1209 | // wtf? is this just due to how we decode the sprite gfx or is something bad happening? |
| 1210 | if ((address&3)==0) NeoSpriteRAM[address] = byteValue; |
| 1211 | if ((address&3)==1) NeoSpriteRAM[address^3] = byteValue; |
| 1212 | if ((address&3)==2) NeoSpriteRAM[address^3] = byteValue; |
| 1213 | if ((address&3)==3) NeoSpriteRAM[address] = byteValue; |
| 1214 | |
| 1215 | // NeoCDOBJBankUpdate[nSpriteTransferBank >> 20] = true; |
| 1180 | 1216 | break; |
| 1181 | 1217 | case 1: // ADPCM |
| 1182 | 1218 | YM2610ADPCMAROM[nNeoActiveSlot][nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = byteValue; |
| r18998 | r18999 | |
| 1200 | 1236 | if (!nTransferWriteEnable) { |
| 1201 | 1237 | // return; |
| 1202 | 1238 | } |
| 1239 | //int address; |
| 1203 | 1240 | |
| 1204 | 1241 | switch (nActiveTransferArea) { |
| 1205 | 1242 | case 0: // Sprites |
| 1206 | | *((UINT16*)(NeoSpriteRAM + nSpriteTransferBank + (sekAddress & 0xFFFFF))) = wordValue; |
| 1207 | | NeoCDOBJBankUpdate[nSpriteTransferBank >> 20] = true; |
| 1243 | neogeoWriteByteTransfer(sekAddress+0, wordValue>>8); |
| 1244 | neogeoWriteByteTransfer(sekAddress+1, wordValue&0xff); |
| 1245 | |
| 1246 | //address = (nSpriteTransferBank + (sekAddress & 0x0FFFFF)); |
| 1247 | //NeoSpriteRAM[(address+0)] = (wordValue&0x00ff)>>0; |
| 1248 | //NeoSpriteRAM[address+1] = (wordValue&0xff00)>>8; |
| 1249 | // *((UINT16*)(NeoSpriteRAM + nSpriteTransferBank + (sekAddress & 0xFFFFF))) = wordValue; |
| 1250 | // NeoCDOBJBankUpdate[nSpriteTransferBank >> 20] = true; |
| 1208 | 1251 | break; |
| 1209 | 1252 | case 1: // ADPCM |
| 1210 | 1253 | YM2610ADPCMAROM[nNeoActiveSlot][nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = wordValue; |
| r18998 | r18999 | |
| 1364 | 1407 | break; |
| 1365 | 1408 | |
| 1366 | 1409 | case 0x0141: |
| 1367 | | // bprintf(PRINT_NORMAL, _T(" - NGCD OBJ BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); |
| 1410 | // bprintf(PRINT_NORMAL, _T(" - NGCD OBJ BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); |
| 1411 | video_reset(); |
| 1412 | /* NO MAME |
| 1368 | 1413 | NeoSetSpriteSlot(0); |
| 1369 | 1414 | for (INT32 i = 0; i < 4; i++) { |
| 1370 | 1415 | if (NeoCDOBJBankUpdate[i]) { |
| r18998 | r18999 | |
| 1372 | 1417 | NeoUpdateSprites((i << 20), 0x100000); |
| 1373 | 1418 | } |
| 1374 | 1419 | } |
| 1420 | */ |
| 1375 | 1421 | |
| 1376 | 1422 | break; |
| 1377 | 1423 | case 0x0143: |
| r18998 | r18999 | |
| 1384 | 1430 | break; |
| 1385 | 1431 | case 0x0149: |
| 1386 | 1432 | // bprintf(PRINT_NORMAL, _T(" - NGCD FIX BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); |
| 1387 | | NeoSetTextSlot(0); |
| 1388 | | NeoUpdateText(0, 0x020000, NeoTextRAM, NeoTextROM[0]); |
| 1433 | video_reset(); |
| 1434 | |
| 1435 | /* NO MAME |
| 1436 | |
| 1437 | NeoSetTextSlot(0); |
| 1438 | NeoUpdateText(0, 0x020000, NeoTextRAM, NeoTextROM[0]); |
| 1439 | */ |
| 1389 | 1440 | break; |
| 1390 | 1441 | |
| 1391 | 1442 | // CD mechanism communication |
| r18998 | r18999 | |
| 1461 | 1512 | break; |
| 1462 | 1513 | |
| 1463 | 1514 | case 0x000E: |
| 1464 | | NeoCDIRQUpdate(wordValue); |
| 1515 | NeoCDIRQUpdate(wordValue); // irqack |
| 1465 | 1516 | break; |
| 1466 | 1517 | |
| 1467 | 1518 | // DMA controller |
| r18998 | r18999 | |
| 1532 | 1583 | |
| 1533 | 1584 | void ng_aes_state::NeoCDCommsWrite(UINT8 data) |
| 1534 | 1585 | { |
| 1586 | //printf("NeoCDCommsWrite %d, %02x\n", NeoCDCommsWordCount, data); |
| 1587 | |
| 1535 | 1588 | if (NeoCDCommsWordCount >= 0 && NeoCDCommsWordCount < 10) { |
| 1536 | 1589 | NeoCDCommsCommandFIFO[NeoCDCommsWordCount] = data & 0x0F; |
| 1537 | 1590 | } |
| r18998 | r18999 | |
| 1838 | 1891 | switch (NeoCDCommsCommandFIFO[3]) { |
| 1839 | 1892 | |
| 1840 | 1893 | case 0: { |
| 1841 | | UINT8* ChannelData = CDEmuReadQChannel(); |
| 1894 | UINT8* ChannelData = CDEmuReadQChannel(NeoCDSectorLBA); |
| 1842 | 1895 | |
| 1843 | 1896 | NeoCDCommsStatusFIFO[2] = ChannelData[1] / 10; |
| 1844 | 1897 | NeoCDCommsStatusFIFO[3] = ChannelData[1] % 10; |
| r18998 | r18999 | |
| 1856 | 1909 | break; |
| 1857 | 1910 | } |
| 1858 | 1911 | case 1: { |
| 1859 | | UINT8* ChannelData = CDEmuReadQChannel(); |
| 1912 | UINT8* ChannelData = CDEmuReadQChannel(NeoCDSectorLBA); |
| 1860 | 1913 | |
| 1861 | 1914 | NeoCDCommsStatusFIFO[2] = ChannelData[4] / 10; |
| 1862 | 1915 | NeoCDCommsStatusFIFO[3] = ChannelData[4] % 10; |
| r18998 | r18999 | |
| 1873 | 1926 | } |
| 1874 | 1927 | case 2: { |
| 1875 | 1928 | |
| 1876 | | UINT8* ChannelData = CDEmuReadQChannel(); |
| 1929 | UINT8* ChannelData = CDEmuReadQChannel(NeoCDSectorLBA); |
| 1877 | 1930 | |
| 1878 | 1931 | NeoCDCommsStatusFIFO[2] = ChannelData[0] / 10; |
| 1879 | 1932 | NeoCDCommsStatusFIFO[3] = ChannelData[0] % 10; |
| r18998 | r18999 | |
| 1934 | 1987 | |
| 1935 | 1988 | case 6: { |
| 1936 | 1989 | |
| 1937 | | UINT8* ChannelData = CDEmuReadQChannel(); |
| 1990 | UINT8* ChannelData = CDEmuReadQChannel(NeoCDSectorLBA); |
| 1938 | 1991 | |
| 1939 | 1992 | NeoCDCommsStatusFIFO[8] = ChannelData[7]; |
| 1940 | 1993 | |
| r18998 | r18999 | |
| 2040 | 2093 | if (NeoCDCommsCommandFIFO[0]) { |
| 2041 | 2094 | INT32 sum = 0; |
| 2042 | 2095 | |
| 2096 | printf("has command %02x\n", NeoCDCommsCommandFIFO[0]); |
| 2097 | |
| 2043 | 2098 | // bprintf(PRINT_NORMAL, _T(" - CD mechanism command receive completed : 0x")); |
| 2044 | 2099 | for (INT32 i = 0; i < 9; i++) { |
| 2045 | 2100 | // bprintf(PRINT_NORMAL, _T("%X"), NeoCDCommsCommandFIFO[i]); |
| r18998 | r18999 | |
| 2049 | 2104 | // bprintf(PRINT_NORMAL, _T(" (CS 0x%X, %s)\n"), NeoCDCommsCommandFIFO[9], (sum == NeoCDCommsCommandFIFO[9]) ? _T("OK") : _T("NG")); |
| 2050 | 2105 | if (sum == NeoCDCommsCommandFIFO[9]) { |
| 2051 | 2106 | |
| 2107 | printf("request to process command %02x\n", NeoCDCommsCommandFIFO[0]); |
| 2108 | |
| 2052 | 2109 | NeoCDProcessCommand(); |
| 2053 | 2110 | |
| 2054 | 2111 | if (NeoCDCommsCommandFIFO[0]) { |
| r18998 | r18999 | |
| 2171 | 2228 | |
| 2172 | 2229 | |
| 2173 | 2230 | |
| 2174 | | WRITE16_MEMBER(ng_aes_state::neocd_control_w) |
| 2231 | READ16_MEMBER(ng_aes_state::neocd_control_r) |
| 2175 | 2232 | { |
| 2176 | | switch(offset) |
| 2233 | if (mem_mask == 0xffff) |
| 2177 | 2234 | { |
| 2178 | | case 0x02/2: // HOCK |
| 2179 | | COMBINE_DATA(&nff0002); |
| 2180 | | printf("nff0002 = %04x %04x\n", data, mem_mask); |
| 2181 | | break; |
| 2235 | return neogeoReadWordCDROM(0xff0000+ (offset*2)); |
| 2236 | } |
| 2237 | else if (mem_mask ==0xff00) |
| 2238 | { |
| 2239 | return neogeoReadByteCDROM(0xff0000+ (offset*2)) << 8; |
| 2240 | } |
| 2241 | else if (mem_mask ==0x00ff) |
| 2242 | { |
| 2243 | return neogeoReadByteCDROM(0xff0000+ (offset*2)+1) & 0xff; |
| 2244 | } |
| 2182 | 2245 | |
| 2183 | | case 0x16/2: |
| 2184 | | COMBINE_DATA(&nff0016); |
| 2185 | | printf("nff0016 = %04x %04x\n", data, mem_mask); |
| 2186 | | break; |
| 2246 | return 0x0000; |
| 2187 | 2247 | |
| 2248 | } |
| 2188 | 2249 | |
| 2189 | | case 0x60/2: // Start DMA transfer |
| 2190 | | if((data & 0xff) == 0x40) |
| 2191 | | neocd_do_dma(space); |
| 2192 | | break; |
| 2193 | | case 0x64/2: // source address, high word |
| 2194 | | m_neocd_ctrl.addr_source = (m_neocd_ctrl.addr_source & 0x0000ffff) | (data << 16); |
| 2195 | | logerror("CTRL: Set source address to %08x\n",m_neocd_ctrl.addr_source); |
| 2196 | | break; |
| 2197 | | case 0x66/2: // source address, low word |
| 2198 | | m_neocd_ctrl.addr_source = (m_neocd_ctrl.addr_source & 0xffff0000) | data; |
| 2199 | | logerror("CTRL: Set source address to %08x\n",m_neocd_ctrl.addr_source); |
| 2200 | | break; |
| 2201 | | case 0x68/2: // target address, high word |
| 2202 | | m_neocd_ctrl.addr_target = (m_neocd_ctrl.addr_target & 0x0000ffff) | (data << 16); |
| 2203 | | logerror("CTRL: Set target address to %08x\n",m_neocd_ctrl.addr_target); |
| 2204 | | break; |
| 2205 | | case 0x6a/2: // target address, low word |
| 2206 | | m_neocd_ctrl.addr_target = (m_neocd_ctrl.addr_target & 0xffff0000) | data; |
| 2207 | | logerror("CTRL: Set target address to %08x\n",m_neocd_ctrl.addr_target); |
| 2208 | | break; |
| 2209 | | case 0x6c/2: // fill word |
| 2210 | | m_neocd_ctrl.fill_word = data; |
| 2211 | | logerror("CTRL: Set fill word to %04x\n",data); |
| 2212 | | break; |
| 2213 | | case 0x70/2: // word count |
| 2214 | | m_neocd_ctrl.word_count = (m_neocd_ctrl.word_count & 0x0000ffff) | (data << 16); |
| 2215 | | logerror("CTRL: Set word count to %i\n",m_neocd_ctrl.word_count); |
| 2216 | | break; |
| 2217 | | case 0x72/2: // word count (low word) |
| 2218 | | m_neocd_ctrl.word_count = (m_neocd_ctrl.word_count & 0xffff0000) | data; |
| 2219 | | logerror("CTRL: Set word count to %i\n",m_neocd_ctrl.word_count); |
| 2220 | | break; |
| 2221 | | case 0x7e/2: // DMA parameters |
| 2222 | | case 0x80/2: |
| 2223 | | case 0x82/2: |
| 2224 | | case 0x84/2: |
| 2225 | | case 0x86/2: |
| 2226 | | case 0x88/2: |
| 2227 | | case 0x8a/2: |
| 2228 | | case 0x8c/2: |
| 2229 | | case 0x8e/2: |
| 2230 | | m_neocd_ctrl.dma_mode[offset-(0x7e/2)] = data; |
| 2231 | | logerror("CTRL: DMA parameter %i set to %04x\n",offset-(0x7e/2),data); |
| 2232 | | break; |
| 2233 | | case 0x104/2: |
| 2234 | | m_neocd_ctrl.area_sel = data & 0x00ff; |
| 2235 | | logerror("CTRL: 0xExxxxx set to area %i\n",data & 0xff); |
| 2236 | | break; |
| 2237 | | case 0x140/2: // end sprite transfer |
| 2238 | | video_reset(); |
| 2239 | | break; |
| 2240 | | case 0x142/2: // end PCM transfer |
| 2241 | | break; |
| 2242 | | case 0x146/2: // end Z80 transfer |
| 2243 | | machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_RESET,PULSE_LINE); |
| 2244 | | break; |
| 2245 | | case 0x148/2: // end FIX transfer |
| 2246 | | video_reset(); |
| 2247 | | break; |
| 2248 | | case 0x1a0/2: |
| 2249 | | m_neocd_ctrl.spr_bank_sel = data & 0xff; |
| 2250 | | logerror("CTRL: Sprite area set to bank %i\n",data & 0xff); |
| 2251 | | break; |
| 2252 | | case 0x1a2/2: |
| 2253 | | m_neocd_ctrl.pcm_bank_sel = data & 0xff; |
| 2254 | | logerror("CTRL: PCM area set to bank %i\n",data & 0xff); |
| 2255 | | break; |
| 2256 | | default: |
| 2257 | | logerror("CTRL: Write offset %04x, data %04x\n",offset*2,data); |
| 2250 | |
| 2251 | WRITE16_MEMBER(ng_aes_state::neocd_control_w) |
| 2252 | { |
| 2253 | if (mem_mask == 0xffff) |
| 2254 | { |
| 2255 | neogeoWriteWordCDROM(0xff0000+ (offset*2), data); |
| 2258 | 2256 | } |
| 2257 | else if (mem_mask ==0xff00) |
| 2258 | { |
| 2259 | neogeoWriteByteCDROM(0xff0000+ (offset*2), data>>8); |
| 2260 | } |
| 2261 | else if (mem_mask ==0x00ff) |
| 2262 | { |
| 2263 | neogeoWriteByteCDROM(0xff0000+ (offset*2)+1, data&0xff); |
| 2264 | } |
| 2259 | 2265 | } |
| 2260 | 2266 | |
| 2267 | |
| 2268 | |
| 2269 | |
| 2261 | 2270 | /* |
| 2262 | 2271 | * Handling NeoCD banked RAM |
| 2263 | 2272 | * When the Z80 space is banked in to 0xe00000, only the low byte of each word is used |
| 2264 | 2273 | */ |
| 2265 | 2274 | |
| 2275 | |
| 2266 | 2276 | READ16_MEMBER(ng_aes_state::neocd_transfer_r) |
| 2267 | 2277 | { |
| 2268 | | UINT16 ret = 0x0000; |
| 2269 | | UINT8* Z80 = memregion("audiocpu")->base(); |
| 2270 | | UINT8* PCM = memregion("ymsnd")->base(); |
| 2271 | | UINT8* FIX = memregion("fixed")->base(); |
| 2272 | | UINT16* SPR = (UINT16*)(*machine().root_device().memregion("sprites")); |
| 2273 | | |
| 2274 | | switch(m_neocd_ctrl.area_sel) |
| 2278 | if (mem_mask == 0xffff) |
| 2275 | 2279 | { |
| 2276 | | case NEOCD_AREA_AUDIO: |
| 2277 | | ret = Z80[offset & 0xffff] | 0xff00; |
| 2278 | | break; |
| 2279 | | case NEOCD_AREA_PCM: |
| 2280 | | ret = PCM[offset + (0x100000*m_neocd_ctrl.pcm_bank_sel)] | 0xff00; |
| 2281 | | break; |
| 2282 | | case NEOCD_AREA_SPR: |
| 2283 | | ret = SPR[offset + (0x80000*m_neocd_ctrl.spr_bank_sel)]; |
| 2284 | | break; |
| 2285 | | case NEOCD_AREA_FIX: |
| 2286 | | ret = FIX[offset & 0x1ffff] | 0xff00; |
| 2287 | | break; |
| 2280 | return neogeoReadWordTransfer(0xe00000+ (offset*2)); |
| 2288 | 2281 | } |
| 2282 | else if (mem_mask ==0xff00) |
| 2283 | { |
| 2284 | return neogeoReadByteTransfer(0xe00000+ (offset*2)) << 8; |
| 2285 | } |
| 2286 | else if (mem_mask ==0x00ff) |
| 2287 | { |
| 2288 | return neogeoReadByteTransfer(0xe00000+ (offset*2)+1) & 0xff; |
| 2289 | } |
| 2289 | 2290 | |
| 2290 | | return ret; |
| 2291 | |
| 2292 | return 0x0000; |
| 2293 | |
| 2291 | 2294 | } |
| 2292 | 2295 | |
| 2293 | 2296 | WRITE16_MEMBER(ng_aes_state::neocd_transfer_w) |
| 2294 | 2297 | { |
| 2295 | | UINT8* Z80 = memregion("audiocpu")->base(); |
| 2296 | | UINT8* PCM = memregion("ymsnd")->base(); |
| 2297 | | UINT8* FIX = memregion("fixed")->base(); |
| 2298 | | UINT16* SPR = (UINT16*)(*machine().root_device().memregion("sprites")); |
| 2299 | | |
| 2300 | | switch(m_neocd_ctrl.area_sel) |
| 2298 | if (mem_mask == 0xffff) |
| 2301 | 2299 | { |
| 2302 | | case NEOCD_AREA_AUDIO: |
| 2303 | | Z80[offset & 0xffff] = data & 0xff; |
| 2304 | | break; |
| 2305 | | case NEOCD_AREA_PCM: |
| 2306 | | PCM[offset + (0x100000*m_neocd_ctrl.pcm_bank_sel)] = data & 0xff; |
| 2307 | | break; |
| 2308 | | case NEOCD_AREA_SPR: |
| 2309 | | COMBINE_DATA(SPR+(offset + (0x80000*m_neocd_ctrl.spr_bank_sel))); |
| 2310 | | break; |
| 2311 | | case NEOCD_AREA_FIX: |
| 2312 | | FIX[offset & 0x1ffff] = data & 0xff; |
| 2313 | | break; |
| 2300 | neogeoWriteWordTransfer(0xe00000+ (offset*2), data); |
| 2314 | 2301 | } |
| 2302 | else if (mem_mask ==0xff00) |
| 2303 | { |
| 2304 | neogeoWriteByteTransfer(0xe00000+ (offset*2), data>>8); |
| 2305 | } |
| 2306 | else if (mem_mask ==0x00ff) |
| 2307 | { |
| 2308 | neogeoWriteByteTransfer(0xe00000+ (offset*2)+1, data&0xff); |
| 2309 | } |
| 2315 | 2310 | |
| 2316 | 2311 | } |
| 2317 | 2312 | |
| r18998 | r18999 | |
| 2410 | 2405 | _set_audio_cpu_rom_source(state->machine().device("maincpu")->memory().space(AS_PROGRAM)); |
| 2411 | 2406 | } |
| 2412 | 2407 | |
| 2408 | |
| 2409 | |
| 2413 | 2410 | static void common_machine_start(running_machine &machine) |
| 2414 | 2411 | { |
| 2415 | 2412 | neogeo_state *state = machine.driver_data<neogeo_state>(); |
| r18998 | r18999 | |
| 2493 | 2490 | |
| 2494 | 2491 | // copy fixed tiles into FIX space (from 0x70000) |
| 2495 | 2492 | memcpy(FIXbios,ROM+0x70000,0x10000); |
| 2493 | |
| 2494 | // for custom vectors |
| 2495 | machine().device("maincpu")->execute().set_irq_acknowledge_callback(neocd_int_callback); |
| 2496 | |
| 2497 | { |
| 2498 | cdrom_image_device *cddevice = machine().device<cdrom_image_device>("cdrom"); |
| 2499 | if ( cddevice ) |
| 2500 | { |
| 2501 | neocd.cd = cddevice->get_cdrom_file(); |
| 2502 | if ( neocd.cd ) |
| 2503 | { |
| 2504 | printf("found cd\n"); |
| 2505 | neocd.toc = cdrom_get_toc( neocd.cd ); |
| 2506 | cdda_set_cdrom( machine().device("cdda"), neocd.cd ); |
| 2507 | cdda_stop_audio( machine().device( "cdda" ) ); //stop any pending CD-DA |
| 2508 | } |
| 2509 | } |
| 2510 | } |
| 2511 | |
| 2512 | |
| 2496 | 2513 | } |
| 2497 | 2514 | |
| 2498 | 2515 | //static DEVICE_IMAGE_LOAD(aes_cart) |
| r18998 | r18999 | |
| 2531 | 2548 | |
| 2532 | 2549 | /* AES apparently always uses the cartridge's fixed bank mode */ |
| 2533 | 2550 | neogeo_set_fixed_layer_source(machine(),1); |
| 2551 | |
| 2552 | NeoSpriteRAM = memregion("sprites")->base(); |
| 2553 | YM2610ADPCMAROM[0] = memregion("ymsnd")->base(); |
| 2554 | NeoZ80ROMActive = memregion("audiocpu")->base(); |
| 2555 | NeoTextRAM = memregion("fixed")->base(); |
| 2556 | curr_space = &machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2557 | |
| 2558 | NeoCDCommsReset(); |
| 2559 | |
| 2560 | nTransferWriteEnable = 0; |
| 2561 | |
| 2534 | 2562 | } |
| 2535 | 2563 | |
| 2536 | 2564 | |
| r18998 | r18999 | |
| 2567 | 2595 | AM_RANGE(0xe00000, 0xffffff) AM_READ(neogeo_unmapped_r) |
| 2568 | 2596 | ADDRESS_MAP_END |
| 2569 | 2597 | |
| 2598 | |
| 2599 | |
| 2570 | 2600 | static ADDRESS_MAP_START( neocd_main_map, AS_PROGRAM, 16, ng_aes_state ) |
| 2571 | 2601 | AM_RANGE(0x000000, 0x00007f) AM_RAMBANK(NEOGEO_BANK_VECTORS) |
| 2572 | 2602 | AM_RANGE(0x000080, 0x0fffff) AM_RAM |
| r18998 | r18999 | |
| 2963 | 2993 | } |
| 2964 | 2994 | |
| 2965 | 2995 | |
| 2996 | /* NeoCD uses custom vectors on IRQ4 to handle various events from the CDC */ |
| 2966 | 2997 | |
| 2998 | static IRQ_CALLBACK(neocd_int_callback) |
| 2999 | { |
| 3000 | ng_aes_state *state = device->machine().driver_data<ng_aes_state>(); |
| 3001 | |
| 3002 | // this is how FBA seems to be setup, but surely this would cause the custom |
| 3003 | // interrupt levels to end up being used for the regular interrupts too in cases? |
| 3004 | if (state->nNeoCDIRQVectorAck) { |
| 3005 | state->nNeoCDIRQVectorAck = 0; |
| 3006 | return state->nNeoCDIRQVector; |
| 3007 | } |
| 3008 | |
| 3009 | return (0x60+irqline*4)/4; |
| 3010 | } |
| 3011 | |
| 2967 | 3012 | void ng_aes_state::NeoCDIRQUpdate(UINT8 byteValue) |
| 2968 | 3013 | { |
| 2969 | 3014 | nIRQAcknowledge |= (byteValue & 0x38); |
| r18998 | r18999 | |
| 2980 | 3025 | if ((nIRQAcknowledge & 0x08) == 0) { |
| 2981 | 3026 | nNeoCDIRQVector = 0x17; |
| 2982 | 3027 | nNeoCDIRQVectorAck = 1; |
| 2983 | | SekSetIRQLine(4, SEK_IRQSTATUS_ACK /*| SEK_IRQSTATUS_CALLBACK*/); |
| 3028 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 2984 | 3029 | return; |
| 2985 | 3030 | } |
| 2986 | 3031 | if ((nIRQAcknowledge & 0x10) == 0) { |
| 2987 | 3032 | nNeoCDIRQVector = 0x16; |
| 2988 | 3033 | nNeoCDIRQVectorAck = 1; |
| 2989 | | SekSetIRQLine(4, SEK_IRQSTATUS_ACK /*| SEK_IRQSTATUS_CALLBACK*/); |
| 3034 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 2990 | 3035 | return; |
| 2991 | 3036 | } |
| 2992 | 3037 | if ((nIRQAcknowledge & 0x20) == 0) { |
| 2993 | 3038 | nNeoCDIRQVector = 0x15; |
| 2994 | 3039 | nNeoCDIRQVectorAck = 1; |
| 2995 | | SekSetIRQLine(4, SEK_IRQSTATUS_ACK /*| SEK_IRQSTATUS_CALLBACK*/); |
| 3040 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 2996 | 3041 | return; |
| 2997 | 3042 | } |
| 2998 | 3043 | } |